fixes handlers not being compatible with deno handlers

This commit is contained in:
2024-11-11 12:41:56 -07:00
parent 05831b364b
commit 67ddb71fdd
3 changed files with 7 additions and 7 deletions

View File

@@ -6,7 +6,7 @@ interface RouterContext {
request: Request;
}
type Handler = (ctx: RouterContext) => Promise<Response> | Response;
type Handler = (req: Request, ctx: RouterContext) => Promise<Response> | Response;
type Middleware = (ctx: RouterContext, next: () => Promise<Response>) => Promise<Response>;
interface RouteConfig {
@@ -247,7 +247,7 @@ export class Router {
return await middleware.handler(middlewareCtx, executeMiddleware);
}
// Final handler gets the accumulated parameters
return await handler(baseCtx);
return await handler(req, baseCtx);
};
try {