Hola estoy usando node con express y handlebars pero cuando intento renderizar la vista me aparece el error mencionado.
Error: Failed to lookup view "home" in views directory "/home/joaquin/workspace/nodejs/EasyRcu/views" at EventEmitter.render (/home/joaquin/workspace/nodejs/EasyRcu/node_modules/express/lib/application.js:579:17) at ServerResponse.render (/home/joaquin/workspace/nodejs/EasyRcu/node_modules/express/lib/response.js:960:7) at index (/home/joaquin/workspace/nodejs/EasyRcu/controllers/home.js:15:17)
at e (/home/joaquin/workspace/nodejs/EasyRcu/controllers/index.js:17:13)
at Layer.handle [as handle_request] (/home/joaquin/workspace/nodejs/EasyRcu/node_modules/express/lib/router/layer.js:95:5) at next (/home/joaquin/workspace/nodejs/EasyRcu/node_modules/express/lib/router/route.js:131:13) at Route.dispatch (/home/joaquin/workspace/nodejs/EasyRcu/node_modules/express/lib/router/route.js:112:3) at Layer.handle [as handle_request] (/home/joaquin/workspace/nodejs/EasyRcu/node_modules/express/lib/router/layer.js:95:5) at /home/joaquin/workspace/nodejs/EasyRcu/node_modules/express/lib/router/index.js:277:22 at Function.process_params (/home/joaquin/workspace/nodejs/EasyRcu/node_modules/express/lib/router/index.js:330:12)
This is my code:
app.use(express.static(__dirname + '/public'));
app.engine('.hbs', exphbs({ defaultLayout: 'main', extname: '.hbs' }));
app.set('views', path.join(__dirname, '/views'));
app.set('view engine', '.hbs');
And the request Handler:
index: (req, res,next)=>{
console.log("entre");
var markup = react_render.renderToString(index());
console.log(markup);
res.render('home', {
markup: markup,
state : {}
});
}
'home.hbs'
en tu carpeta views?