-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtypes.ts
More file actions
37 lines (33 loc) · 775 Bytes
/
Copy pathtypes.ts
File metadata and controls
37 lines (33 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { ServerRequest } from "https://deno.land/std/http/server.ts";
export enum QueryType {
GET = "GET",
POST = "POST",
PUT = "PUT",
DELETE = "DELETE",
OPTIONS = "OPTIONS",
HEAD = "HEAD",
PATCH = "PATCH",
}
export type EndpointMap = Map<string, (req: ServerRequest, vars: RouteVariables) => void>;
export type EndpointRoutes = Map<QueryType, EndpointMap>;
export type Endpoint = {
uri: string;
routes: {
getRoutes: EndpointMap;
postRoutes: EndpointMap;
putRoutes: EndpointMap;
deleteRoutes: EndpointMap;
optionsRoutes: EndpointMap;
headRoutes: EndpointMap;
patchRoutes: EndpointMap;
};
};
export type RouteVariables = {
query: {
[key: string]: string;
};
param: {
[key: string]: string;
},
body: any
};