feat: express调整
This commit is contained in:
parent
daac931994
commit
ab98000ab1
@ -253,11 +253,11 @@ if (isProd) {
|
|||||||
app.use(express.static(distPath));
|
app.use(express.static(distPath));
|
||||||
|
|
||||||
// SPA 回退:所有非 API 请求返回 index.html
|
// SPA 回退:所有非 API 请求返回 index.html
|
||||||
app.get('*', (req, res) => {
|
app.get('/{*path}', (req, res) => {
|
||||||
res.sendFile(path.resolve(distPath, 'index.html'));
|
res.sendFile(path.resolve(distPath, 'index.html'));
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post('*', (req, res) => {
|
app.post('/{*path}', (req, res) => {
|
||||||
res.sendFile(path.resolve(distPath, 'index.html'));
|
res.sendFile(path.resolve(distPath, 'index.html'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user