Skip to content

Commit 2f4c3be

Browse files
committed
Fix dev script
1 parent 0c8d5f2 commit 2f4c3be

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

scripts/dev.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ const fs = require('fs-extra');
55
const app = express();
66
const root = './build';
77

8+
// redirects for / root
9+
app.use((req, res, next) => {
10+
if (req.path === '/') {
11+
// eslint-disable-next-line no-console
12+
console.log('[REDIRECT]', `from [${req.path}]`, `to [/docs]`);
13+
return res.redirect(301, '/docs');
14+
}
15+
return next();
16+
});
17+
818
// redirect from /folder to /folder/ if it is directory
919
app.use(async (req, res, next) => {
1020
const reqPath = decodeURIComponent(req.path);

0 commit comments

Comments
 (0)