New API route format to make code cleaner

This commit is contained in:
Jesse Wierzbinski 2023-10-15 17:51:29 -10:00
parent c7b2f5b741
commit ca7d325cb1
36 changed files with 600 additions and 237 deletions

12
types/api.ts Normal file
View file

@ -0,0 +1,12 @@
export interface APIRouteMeta {
allowedMethods: ("GET" | "POST" | "PUT" | "DELETE" | "PATCH")[];
ratelimits: {
max: number;
duration: number;
};
route: string;
auth: {
required: boolean;
requiredOnMethods?: ("GET" | "POST" | "PUT" | "DELETE" | "PATCH")[];
};
}