Html 无法获取/ejs文件
我正在尝试用html完成调查页面的统计 当我尝试连接到该网页的ejs视图时,它给了我无法获取/显示结果的信息Html 无法获取/ejs文件,html,node.js,Html,Node.js,我正在尝试用html完成调查页面的统计 当我尝试连接到该网页的ejs视图时,它给了我无法获取/显示结果的信息 // Entry point for the application // express application var express = require('express'); // require the controller we make var surveyController = require('./surveyController'); var app = exp
// Entry point for the application
// express application
var express = require('express');
// require the controller we make
var surveyController = require('./surveyController');
var app = express();
// set up template engine
app.set('view engine', 'ejs');
// static file serving
app.use(express.static('./public'));
// fire function from surveyController
surveyController(app);
// listen to port
app.listen(8080);
console.log('listening port 8080');
我有一个网页和app.js文件的HTML视图,似乎在控制台上运行,但当我登录到http://localhost:8080/showResults在这里,您可以通过
app.js中的以下设置查看ejs
// Entry point for the application
// express application
var express = require('express');
// require the controller we make
var surveyController = require('./surveyController');
var app = express();
// set up template engine
app.set('view engine', 'ejs');
// static file serving
app.use(express.static('./public'));
// fire function from surveyController
surveyController(app);
// listen to port
app.listen(8080);
console.log('listening port 8080');
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
//使用res.render加载ejs视图文件
app.get('/',函数(req,res){
res.render('/index');
});