Hi guys I have a little problem: I'm trying to handle a 403 error using
nodejs and express framework.
First of all I have added in app.js the following code:
<code>
app.get('/commonUser', routes.commonUser);
</code>
Then in ./routes/index.js I've added this:
<code>
exports.commonUser = function(req, res) {
if(req.session.commonUserId) {
res.status(200);
res.render('commonUser');
} else {
res.status(403);
res.render('403');
}
}
</code>
But when I' m not logged in and I try to access to commonUser page I always
get 500 Error. This is caused because req.session.commonUserId not exist?
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.