Il giorno sabato 26 aprile 2014 12:01:25 UTC+2, Fabio Baravalle ha scritto: > > The error displayed is this > > Express 500 Error: Failed to lookup view "TypeError: Cannot read property > 'commonUserId' of undefined" in views directory > "C:\Users\Fabio\Desktop\SitoStatistica\views" at Function.app.render (C:\Users\Fabio\Desktop\SitoStatistica\node_modules\express\lib\application.js:493:17) at ServerResponse.res.render (C:\Users\Fabio\Desktop\SitoStatistica\node_modules\express\lib\response.js:798:7) at Object.handle (C:\Users\Fabio\Desktop\SitoStatistica\app.js:32:6) at next (C:\Users\Fabio\Desktop\SitoStatistica\node_modules\express\node_modules\connect\lib\proto.js:188:17) at next (C:\Users\Fabio\Desktop\SitoStatistica\node_modules\express\node_modules\connect\lib\proto.js:190:11) at next (C:\Users\Fabio\Desktop\SitoStatistica\node_modules\express\node_modules\connect\lib\proto.js:190:11) at pass (C:\Users\Fabio\Desktop\SitoStatistica\node_modules\express\lib\router\index.js:110:24) at nextRoute (C:\Users\Fabio\Desktop\SitoStatistica\node_modules\express\lib\router\index.js:100:7) at callbacks (C:\Users\Fabio\Desktop\SitoStatistica\node_modules\express\lib\router\index.js:167:11)
at callbacks (C:\Users\Fabio\Desktop\SitoStatistica\node_modules\express\lib\router\index.js:170:9) > > Il giorno sabato 26 aprile 2014 01:18:59 UTC+2, Alan Hoffmeister ha > scritto: >> >> What's The message being displayed in te terminal when you receive 500? >> >> >> On 25 de abril de 2014 19h28min18s BRT, Fabio Baravalle < >> [email protected]> wrote: >>> >>> 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? >>> >>> >> -- >> E-mail enviado do meu celular usando Kaiten Mail. Por favor, desculpe >> minha brevidade. >> > -- -- 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.
