Aga
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
The problem I see is that you car calling next() before you finish reading the file.
But, I dont understand why you want to let know to the next middleware that this one has fail?
I havent seen that a lot.. For instance lot of authentication code do something along these lines:
function addUserToRequest(req, res, next) {
getUser(req.session.userId, function foo(err, user) {
if(err) {
return res.send(401); ///respond with unauthorized and do not call the next middleware.
}
req.user = user; //put the user in the request object so the next middleware can use it
next(); //call the next middleware.
});
}