mirror of
https://github.com/Redume/Kekkai.git
synced 2025-02-23 12:43:12 +03:00
feat(server): Changed 404 error to match a single response style
This commit is contained in:
parent
b49bd33a93
commit
7f288cbaae
1 changed files with 8 additions and 0 deletions
|
@ -33,6 +33,14 @@ fastify.register(getRateRoute);
|
||||||
fastify.register(configurationRoutes);
|
fastify.register(configurationRoutes);
|
||||||
fastify.register(HomeRoute);
|
fastify.register(HomeRoute);
|
||||||
|
|
||||||
|
fastify.setNotFoundHandler(function (res, reply) {
|
||||||
|
return reply.status(404).send({
|
||||||
|
status: 404,
|
||||||
|
message: 'Page not found!',
|
||||||
|
documentation: 'https://kekkai-docs.redume.su/'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
fastify.addHook('onResponse', async (request, reply) => {
|
fastify.addHook('onResponse', async (request, reply) => {
|
||||||
const routePart = request.raw.url.split('/');
|
const routePart = request.raw.url.split('/');
|
||||||
const routePartFiltered = routePart
|
const routePartFiltered = routePart
|
||||||
|
|
Loading…
Add table
Reference in a new issue