nodejsinaction icon indicating copy to clipboard operation
nodejsinaction copied to clipboard

[ ch06-connect-and-express/listing6_7 ] Error: Failed to lookup view "index" in views

Open wsapiens opened this issue 8 years ago • 1 comments

I got the error when I hit http://localhost:3000 after running the example code. But the error goes away, if I change routes/index.js like below with specifying 'index' to 'index.jade'. However I feel original intention is pointing index.jade automatically by just saying 'index' in render function.

Can you please point where I should fix to work?

/* GET home page. */
router.get('/', function(req, res, next) {
  res.render('index.jade', { title: 'Express' });
});

wsapiens avatar Sep 07 '17 03:09 wsapiens

ah, I think we want to change below line in app.js

from app.set('view engine', 'ejs'); to app.set('view engine', 'jade');

So I suggested code change on app.js as such, since there is error.jade too

wsapiens avatar Sep 07 '17 03:09 wsapiens