Update API routes function. Add middleware. Update README.md

This commit is contained in:
2026-03-17 19:38:06 +01:00
parent ee1fb5897e
commit 35930857fd
20 changed files with 747 additions and 312 deletions
+11 -1
View File
@@ -48,6 +48,15 @@ export type BunextConfig = {
globalVars?: { [k: string]: any };
port?: number;
development?: boolean;
middleware?: (
params: BunextConfigMiddlewareParams,
) => Promise<Response | undefined> | Response | undefined;
};
export type BunextConfigMiddlewareParams = {
req: Request;
url: URL;
server: Server;
};
export type GetRouteReturn = {
@@ -69,6 +78,7 @@ export type BunxRouteParams = {
* Intercept and Transform the response object
*/
resTransform?: (res: Response) => Promise<Response> | Response;
server?: Server;
};
export interface PostInsertReturn {
@@ -146,7 +156,7 @@ export type BunextPageModule = {
default: FC<any>;
server?: BunextPageServerFn;
meta?: BunextPageModuleMeta | BunextPageModuleMetaFn;
head?: FC<BunextPageHeadFCProps>;
Head?: FC<BunextPageHeadFCProps>;
};
export type BunextPageModuleMetaFn = (params: {