Leo*_*ban 2 javascript node.js express
我正在尝试sendFile从我的客户端目录中的index.html,它与我的服务器目录处于同一级别,并收到以下错误:
TypeError: undefined is not a function
at Object.handle (/myapp/server/routes/routes.js:24:7)
Run Code Online (Sandbox Code Playgroud)
这是我的routes.js的第24行:
res.sendFile(path.join(__dirname + '../client/dashboard/index.html'));
功能齐全
dashRouter.get('/', function(req, res) {
console.log('try to load dashboard');
// res.render('../index.html');
// res.send('dashboard!');
res.sendFile(path.join(__dirname + '../client/dashboard/index.html'));
});
return dashRouter;
Run Code Online (Sandbox Code Playgroud)
我的文件夹结构:

使用Express 4.10.0
你知道我为什么会res.sendFile在线上得到那个未定义的错误吗?
| 归档时间: |
|
| 查看次数: |
2898 次 |
| 最近记录: |