decentralised sync engine

refactor: route handler type

serenity b949cd1d 36e3375f

Changed files
+12 -1
src
lib
types
+12 -1
src/lib/types/routes.ts
···
-
import type { FastifyReply, FastifyRequest } from "fastify";
import type { WebSocket } from "ws";
export type RouteHandler = (
···
reply: FastifyReply,
) => Response | Promise<Response>;
export type Method = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
export interface Route {
···
method?: Method;
handler?: RouteHandler;
wsHandler: WsRouteHandler;
skipRegistrationCheckHttp?: true;
skipRegistrationCheckWs?: true;
}
···
+
import type {
+
FastifyReply,
+
FastifyRequest,
+
HookHandlerDoneFunction,
+
} from "fastify";
import type { WebSocket } from "ws";
export type RouteHandler = (
···
reply: FastifyReply,
) => Response | Promise<Response>;
+
export type PreHandler = (
+
req: FastifyRequest,
+
reply: FastifyReply,
+
done: HookHandlerDoneFunction,
+
) => void;
+
export type Method = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
export interface Route {
···
method?: Method;
handler?: RouteHandler;
wsHandler: WsRouteHandler;
+
preHandler?: PreHandler;
skipRegistrationCheckHttp?: true;
skipRegistrationCheckWs?: true;
}