node.js - Error: Can't set headers after they are sent when redirect -


error: can't set headers after sent.

try{ db.collection('user-details').findone({username: req.body.username}, function (err, user) { console.log('toal user='+user); assert.equal(err, null); if(user){ console.log('user exists...!'); return res.redirect('/');

            }         })     }     catch (e){         print(e);     } 


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

Qt QGraphicsScene is not accessable from QGraphicsView (on Qt 5.6.1) -

What is happening when Matlab is starting a "parallel pool"? -