It seems like you're missing 500.handlebars (or maybe .hbs) error message
in "d:\projects\meadowlark\site\views".
Do you have a 500.* file anywhere in your app? If yes, did you point your
views directory somewhere else then default? If yes, maybe put a
500.handlebars in the views/ dir.
If not, lookup somewhere on the net for an example or to be quick about it,
put this in d:\projects\meadowlark\site\views\500.handlebars:
<div>{{error}}</div>
Then, as Ryan here says, you'll have to find your actual error, but that's
another question :)
On Sunday, January 4, 2015 9:23:01 AM UTC+1, sachin tiwari wrote:
>
> Hi,
>
> I am beginner to node.js. I am working with an example here with and I am
> using 'handlebars'. But I am unable to load view of pages. I have kept my
> pages inside views folder but I am not able to see results.
>
> I am getting error.
>
> Error: Failed to lookup view "500" in views directory
> "d:\projects\meadowlark\site\views"
> at EventEmitter.app.render
> (d:\projects\meadowlark\site\node_modules\express\lib\application.js:519:17)
> at ServerResponse.res.render
> (d:\projects\meadowlark\site\node_modules\express\lib\response.js:904:7)
> at d:\projects\meadowlark\site\meadowlark.js:29:7
> at Layer.handle_error
> (d:\projects\meadowlark\site\node_modules\express\lib\router\layer.js:58:5)
> at trim_prefix
> (d:\projects\meadowlark\site\node_modules\express\lib\router\index.js:269:13)
> at
> d:\projects\meadowlark\site\node_modules\express\lib\router\index.js:238:9
> at Function.proto.process_params
> (d:\projects\meadowlark\site\node_modules\express\lib\router\index.js:313:12)
> at
> d:\projects\meadowlark\site\node_modules\express\lib\router\index.js:229:12
> at Function.match_layer
> (d:\projects\meadowlark\site\node_modules\express\lib\router\index.js:296:3)
> at next
> (d:\projects\meadowlark\site\node_modules\express\lib\router\index.js:190:10)
>
> Please help me regardng this to solve it.
>
> My js code is as follows:
> var express = require('express');
> var app = express();
> // set up handlebars view engine
> var handlebars = require('express3-handlebars')
> .create({ defaultLayout:'main' });
> app.engine('handlebars', handlebars.engine);
> app.set('view engine', 'handlebars');
>
> app.set('port',process.env.port || 3000);
>
> app.get('/', function(req, res) {
> res.render('home');
> });
>
> app.get('/about', function(req, res) {
> res.render('about');
> });
>
> // 404 catch-all handler (middleware)
> app.use(function(req, res, next){
> res.status(404);
> res.render('404');
> });
>
> // 500 error handler (middleware)
> app.use(function(err, req, res, next){
> console.error(err.stack);
> res.status(500);
> res.render('500');
> });
>
> app.listen(app.get('port'),function(){
> console.log('Express started on http://localhost: '+ app.get('port') + "
> Press CTRL+C to terminate.");
> });
>
>
> Thank you,
> Sachin
>
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/b0fa5834-4410-4a71-9a4d-c290ecaed125%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.