API: Redirect 404 routes to homepage
This commit is contained in:
@@ -9,3 +9,4 @@ DB_ROOTPW=
|
||||
DB_PORT=
|
||||
API_PORT=3080
|
||||
API_ACCESS_TOKEN=
|
||||
HOMEPAGE_URL=
|
||||
@@ -84,6 +84,11 @@ router.get('/most-recent-drop', async (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
//Fallback route - Has to be defined last!
|
||||
router.all('*', (req, res) => {
|
||||
res.redirect(process.env.HOMEPAGE_URL);
|
||||
});
|
||||
|
||||
app.use(PREFIX, router);
|
||||
app.use(PREFIX, groupRoutes);
|
||||
app.use(PREFIX, badgeRoutes);
|
||||
|
||||
Reference in New Issue
Block a user