move query and params to request, aswell as make method and accepts multistringable

This commit is contained in:
creations 2025-03-15 18:59:01 -04:00
parent 0a881c354b
commit f25fe6fab5
Signed by: creations
GPG key ID: 8F553AA4320FC711
4 changed files with 54 additions and 27 deletions

9
types/bun.d.ts vendored
View file

@ -1,9 +1,14 @@
import type { Server } from "bun";
type Query = Record<string, string>;
type Params = Record<string, string>;
declare global {
type BunServer = Server;
type ExtendedRequest = Request & {
interface ExtendedRequest extends Request {
startPerf: number;
};
query: Query;
params: Params;
}
}

11
types/routes.d.ts vendored
View file

@ -1,20 +1,15 @@
type RouteDef = {
method: string;
accepts: string | null;
method: string | string[];
accepts: string | null | string[];
returns: string;
needsBody?: "multipart" | "json";
};
type Query = Record<string, string>;
type Params = Record<string, string>;
type RouteModule = {
handler: (
request: Request,
server: BunServer,
requestBody: unknown,
query: Query,
params: Params,
server: BunServer,
) => Promise<Response> | Response;
routeDef: RouteDef;
};