diff options
Diffstat (limited to 'lib/app.js')
| -rw-r--r-- | lib/app.js | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -37,4 +37,19 @@ app.register(fastifyStatic, { app.register(fastifyWs); app.register(socketServer); +app.setErrorHandler((error, request, reply) => { + if (error instanceof fastify.errorCodes.FST_ERR_BAD_STATUS_CODE) { + reply.status(500).send({ ok: false }) + } else { + reply.send(error) + } +}) + +app.setNotFoundHandler((request, reply) => { + reply + .code(404) + .type("text/html") + .send("Not Found"); +}); + export default app; |
