This is my index.js
app.get('/api/user', auth.authenticate, function(req, res){
res.send("hi");
});
This is my auth.authenticate function:
exports.authenticate = function(req, res,done) {
// function checkToken(req,res,next){
console.log(req.body);
authToken = req.body["auth_token"]
consumerKey = req.body["consumer_key"]
checkAuth(authToken,consumerKey,function response(user){
done();
});
}
After authenticating, I want to return "user" back to the app.get in index.js so that I can use it to retrieve more data but I'm somehow not able to understand how to do that.
Is it possible to send user via the done() callback? I tried it but was unsuccessful.