Express + node.js kullanıyorum ve bir req nesnesi var, tarayıcıda istek / hesap ama req.path giriş yaptığımda '/' --- '/ account' değil.
//auth required or redirect
app.use('/account', function(req, res, next) {
console.log(req.path);
if ( !req.session.user ) {
res.redirect('/login?ref='+req.path);
} else {
next();
}
});
req.path / hesap ne zaman olmalıdır?
req.routetanımsız. Ekspres kullanıyorum 3.4.4. Rotanın tanımlanmamasına ne sebep olabilir?
TypeError: Cannot read property 'path' of undefined