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 -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -