move query and params to request, aswell as make method and accepts multistringable
This commit is contained in:
parent
0a881c354b
commit
f25fe6fab5
4 changed files with 54 additions and 27 deletions
9
types/bun.d.ts
vendored
9
types/bun.d.ts
vendored
|
@ -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
11
types/routes.d.ts
vendored
|
@ -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;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue