Reputation: 570
Here is the picture of my project structure.
I am trying to render the add.handlebars when the user visit the route /ideas/me
.Here is my code.
app.get('/ideas/add',(req,res)=>{
res.render('ideas/add');
})
I understand this is really silly question but when I visit that route it gives Error: Failed to lookup view "ideas/add" in views directory "D:\@Mock Up Sites\vidjot\views"
.I can fix this easily by telling the template engines to look in all the subfolders of views. But Why this is not working. I am heck sure the directory is correct.
Upvotes: 0
Views: 665
Reputation: 13669
add following line in your app.js
app.set('views', path.join(__dirname, 'views/'));
Upvotes: 1