-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathroutes.ts
More file actions
45 lines (43 loc) · 1.16 KB
/
routes.ts
File metadata and controls
45 lines (43 loc) · 1.16 KB
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
38
39
40
41
42
43
44
45
import { APIGatewayProxyEventV2 } from "aws-lambda";
import { APIGatewayProxyStructuredResultV2 } from "aws-lambda/trigger/api-gateway-proxy";
import { chaptersController } from "./controllers/chapters.controller";
import { chapterIconController } from "./controllers/chapter-icon.controller";
import { healthController } from "./controllers/health.controller";
import { notifyController } from "./controllers/notify.controller";
type Route = {
method: "GET" | "POST" | "PUT" | "DELETE";
path: string;
controller: Controller;
};
export type Controller = (
event: APIGatewayProxyEventV2
) =>
| APIGatewayProxyStructuredResultV2
| Promise<APIGatewayProxyStructuredResultV2>;
export const routes: Array<Route> = [
{
method: "GET",
path: "/info/events",
controller: chaptersController,
},
{
method: "GET",
path: "/info/chapter-icons/[A-Za-z-]+",
controller: chapterIconController,
},
{
method: "GET",
path: "/info/health",
controller: healthController,
},
{
method: "GET",
path: "/api/health",
controller: healthController,
},
{
method: "POST",
path: "/api/notify",
controller: notifyController,
},
];