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 -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -