新手求大神解答!
//导入依赖模块
var express = require('express');
//设置端口
var port = process.env.PORT || 3000;
var app = express();
app.set('views', './views');
app.set('view engine', 'jade');
app.listen(port);
console.log('server running on port: '+port);
// index page
app.get('/', function(req, res) {
res.render('index', {
title: 'index page'
})
});
// detail page
app.get('/movie/:id', function(req, res) {
res.render('detail', {
title: 'detail page'
})
});
// list page
app.get('/admin/list', function(req, res) {
res.render('list', {
title: 'list page'
})
});
// admin page
app.get('/admin/movie', function(req, res) {
res.render('admin', {
title: 'admin page'
})
});
//==========================================//
上面代码依旧会报错, 不知道哪里出问题, 跪求高手指点!
Error: Failed to lookup view "index" in views directory "./views"
at EventEmitter.render (f:\www\nodemongo\node_modules\express\lib\application.js:579:17)
at ServerResponse.render (f:\www\nodemongo\node_modules\express\lib\response.js:961:7)
at f:\www\nodemongo\app.js:16:7
at Layer.handle [as handle_request] (f:\www\nodemongo\node_modules\express\lib\router\layer.js:95:5)
at next (f:\www\nodemongo\node_modules\express\lib\router\route.js:131:13)
at Route.dispatch (f:\www\nodemongo\node_modules\express\lib\router\route.js:112:3)
at Layer.handle [as handle_request] (f:\www\nodemongo\node_modules\express\lib\router\layer.js:95:5)
at f:\www\nodemongo\node_modules\express\lib\router\index.js:277:22
at Function.process_params (f:\www\nodemongo\node_modules\express\lib\router\index.js:330:12)
at next (f:\www\nodemongo\node_modules\express\lib\router\index.js:271:10)