Compare commits
1 Commits
presejpack
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 16b0568bf1 |
@@ -30,8 +30,15 @@ app.use((req, res, next) => {
|
|||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Serve static files from the 'dist' directory
|
// Serve static files from the 'dist' directory, but bypass index.html requests
|
||||||
app.use(express.static(path.join(__dirname, 'dist')));
|
// so they can be handled dynamically by our fallback route.
|
||||||
|
app.use((req, res, next) => {
|
||||||
|
if (req.url === '/index.html') {
|
||||||
|
return next();
|
||||||
|
}
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
app.use(express.static(path.join(__dirname, 'dist'), { index: false }));
|
||||||
|
|
||||||
// Fallback to index.html for Single Page Application routing, injecting base path from headers
|
// Fallback to index.html for Single Page Application routing, injecting base path from headers
|
||||||
app.get('*', (req, res) => {
|
app.get('*', (req, res) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user