【发布时间】:2019-03-08 10:00:57
【问题描述】:
我正在尝试从 angular 上的服务发送 http 方法到 nodejs 上的 api 到它向服务器请求但出现此错误:
Error: ENOENT: no such file or directory, stat 'E:\client\index.html'
这是我的代码:
//rutas
app.use('/', express.static('client', {redirect:false}));
app.use('/api', insumos_routes);
app.get('*', function(req, res, next){
res.sendFile(path.resolve('/client/index.html'));
});
//export
module.exports= app;
已经尝试过:
res.sendFile('/client/index.html');
res.sendFile('./index.html');
...就像它说别人的答案
【问题讨论】:
-
能否提供项目的完整目录结构?