Tuesday 23 May 2017

Need help with middleware.

I have a post request, which i have a middleware function being called onto it. like so:app.post('/sign-up', signUp, function(req, res){}) Here's the signUp function: var signUp = function(req, res) { //Simplified for brevity if (user) { res.redirect('/'); } else { res.redirect('/login') } res.end(); } My problem is, it's not redirecting to the page. I know im doing something wrong, im new to middleware. Would like some tips. Thanks.

Submitted May 23, 2017 at 11:40AM by farhansyed7911

No comments:

Post a Comment