forked from Hri7566/mpp-server-dev2
fix local index.html not loading on /
This commit is contained in:
parent
58a22828f4
commit
ce286fef1a
2
index.js
2
index.js
|
@ -55,7 +55,7 @@ if (config.hostDevFiles) {
|
||||||
|
|
||||||
app.get('*', (req, res, next) => {
|
app.get('*', (req, res, next) => {
|
||||||
let file = path.join(dir, req.path);
|
let file = path.join(dir, req.path);
|
||||||
if (fs.existsSync(file)) {
|
if (fs.existsSync(file) && !file.endsWith('/') && !file.endsWith('\\')) {
|
||||||
res.sendFile(file);
|
res.sendFile(file);
|
||||||
} else {
|
} else {
|
||||||
res.sendFile(path.join(dir, 'index.html'));
|
res.sendFile(path.join(dir, 'index.html'));
|
||||||
|
|
Loading…
Reference in New Issue