I have this code snippet, where the callback only works when I define an anonymous function.
I wonder why sending res.send() function as a callback doesn't work? Shouldn't it work the same as the anonymous function? Like .then() should pass the argument to res.send() and call it.
What am I missing here?
const create = (req, res) => {
// This works.
Driver.create(req.body).then((driver) => res.send(driver));
// This doesn't work!
Driver.create(req.body).then(res.send);
};