Skip to content

Commit 8c9fabf

Browse files
author
Ahmed Elghareeb
committed
refactor: change 404 error message to be more meaniningful
This ensures the user would know the difference between object not found, and route not found. Also switch to use, so the message is displayed for all http methods
1 parent e2bd15a commit 8c9fabf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

web/backend/src/Server.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ app.use('/api', authenticationRouter);
4545
app.use('/api/evoting', delaRouter);
4646
app.use('/api', proxiesRouter);
4747
app.use('/api', usersRouter);
48-
app.get('*', (req, res) => {
49-
console.log('404 not found');
48+
49+
app.use('*', (req, res) => {
50+
console.log('404 route not recognized');
5051
const url = new URL(req.url, `http://${req.headers.host}`);
5152
res.status(404).send(`not found ${xss(url.toString())}`);
5253
});

0 commit comments

Comments
 (0)