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
Post a Comment