Skip to content

Commit

Permalink
fix(unassigned-routes): handle urls which have not been routed
Browse files Browse the repository at this point in the history
[Fixes #161008523]
  • Loading branch information
akhilome committed Oct 5, 2018
1 parent a69ee85 commit 1ea1596
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ app.use('/api/v1/auth', authRouter);
// Menu routes
app.use('/api/v1/menu', menuRouter);

// Catch all unassigned routes
app.all('*', (req, res) => {
res.status(404).json({
status: 'error',
message: 'no route has been assigned to that URL',
});
});

app.listen(process.env.PORT);

export default app;

0 comments on commit 1ea1596

Please sign in to comment.