Skip to content

Commit

Permalink
new router added: breaking changes included
Browse files Browse the repository at this point in the history
  • Loading branch information
a4arpon committed Nov 11, 2024
1 parent 43cf723 commit 53128e2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/hot-shot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,15 @@ export type RouteDefinition = {
useGuards?: MiddlewareType[]
}

export interface RouteBuilder {
useGuards(...guards: MiddlewareType[]): RouteBuilder;
controller(handler: (ctx: Context) => Promise<ApiResponse>): RouteDefinition;
}

export function route(
method: "POST" | "GET" | "PUT" | "DELETE" | "PATCH",
path?: string,
) {
): RouteBuilder {
const routeDefinition: RouteDefinition = {
method,
path: path ?? "/",
Expand Down

0 comments on commit 53128e2

Please sign in to comment.