feat(server): allow single method API routes (#24)

This commit is contained in:
Leo K
2021-06-10 23:26:16 +02:00
committed by GitHub
parent 572b8123c4
commit ae1e311eb8
7 changed files with 74 additions and 15 deletions
+4 -4
View File
@@ -13,13 +13,13 @@ export interface Page {
component: ComponentType<PageProps>;
}
export interface ApiRouteModule {
default: router.MatchHandler;
}
export type ApiRouteModule = {
[K in "default" | typeof router.METHODS[number]]?: router.MatchHandler;
};
export interface ApiRoute {
route: string;
url: string;
name: string;
handler: router.MatchHandler;
handlers: Record<string, router.MatchHandler>;
}