summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-11-05 21:59:12 +1100
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-11-05 21:59:12 +1100
commit4469acd3906d64cbc3d3e0f08a13475daef315ec (patch)
tree3474b31bb535655728fad281c85e5ebc076698cf /src
parentRewrite gateway message decoding (diff)
downloadserver-4469acd3906d64cbc3d3e0f08a13475daef315ec.tar.xz
Fix 404 handler
Diffstat (limited to 'src')
-rw-r--r--src/api/Server.ts7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/api/Server.ts b/src/api/Server.ts

index 6c4b5652..c7e53d70 100644 --- a/src/api/Server.ts +++ b/src/api/Server.ts
@@ -74,15 +74,16 @@ export class FosscordServer extends Server { path.join(__dirname, "routes", "/"), ); + // 404 is not an error in express, so this should not be an error middleware + // this is a fine place to put the 404 handler because its after we register the routes + // and since its not an error middleware, our error handler below still works. api.use( "*", - (error: any, req: Request, res: Response, next: NextFunction) => { - if (error) return next(error); + (req: Request, res: Response, next: NextFunction) => { res.status(404).json({ message: "404 endpoint not found", code: 0, }); - next(); }, );