Why cant I inline call to res.json?
The json
function loses its correct this
binding when used like that since .then
is going to invoke it directly without reference to the res
parent object, so bind it:
var getUserInline = function(req, res) { getUserFromDatabase().then(res.json.bind(res)); }