【发布时间】:2017-06-29 14:54:27
【问题描述】:
我正在使用 Angular CLI (ng4) 并在我的代理配置中声明了我的应用程序之外的其余 api 调用。
在 ng build --prod --aot=true 之后,我得到状态码 404。在开发模式中它正在工作。我该怎么做才能解决这个问题?
我的 app.ts 文件
if (app.get("env") === "development") {
app.use('/assets', express.static(path.join(__dirname, '../../src/assets')));
// app.use('/', express.static(path.join(__dirname, '../../src/pages')));
app.use(function(err, req: express.Request, res: express.Response, next: express.NextFunction) {
res.status(err.status || 500);
res.json({
error: err,
message: err.message
});
});
}
if (app.get('env') === 'production') {
// in production mode run application from dist folder
app.use(express.static(path.join(__dirname, '/../client')));
}
【问题讨论】:
标签: angular