【发布时间】:2015-04-20 22:46:26
【问题描述】:
在我的 server.js 下我有以下
app.use(express.static(__dirname + '/public'));
app.get('/', function(req, res){
res.sendFile('index.html');
});
app.get('/report', function(req, res){
res.sendFile('report.html');
});
当我启动服务器并在http://localhost:8000 上呈现时,我能够看到 index.html,但在 http://localhost:8000/report 上我无法呈现 report.html,而是出现路径错误 path must be absolute或指定 root 到 res.sendFile
我的目录结构是
public
index.html
report.html
为什么会出现这个错误?
【问题讨论】: