forked from pinks/eris
1
0
Fork 0
eris/api/serveApi.ts

26 lines
836 B
TypeScript
Raw Normal View History

2023-10-17 13:03:14 +00:00
import { createLoggerMiddleware, createPathFilter } from "t_rest/server";
2023-10-23 00:39:01 +00:00
import { adminsRoute } from "./adminsRoute.ts";
2023-10-17 13:03:14 +00:00
import { botRoute } from "./botRoute.ts";
2023-10-05 09:00:51 +00:00
import { jobsRoute } from "./jobsRoute.ts";
2023-10-09 19:03:31 +00:00
import { paramsRoute } from "./paramsRoute.ts";
2023-10-05 09:00:51 +00:00
import { sessionsRoute } from "./sessionsRoute.ts";
2023-10-09 19:03:31 +00:00
import { statsRoute } from "./statsRoute.ts";
2023-10-05 09:00:51 +00:00
import { usersRoute } from "./usersRoute.ts";
2023-10-11 01:59:52 +00:00
import { workersRoute } from "./workersRoute.ts";
2023-10-05 09:00:51 +00:00
2023-10-09 19:03:31 +00:00
export const serveApi = createLoggerMiddleware(
createPathFilter({
2023-10-23 00:39:01 +00:00
"admins": adminsRoute,
"bot": botRoute,
2023-10-09 19:03:31 +00:00
"jobs": jobsRoute,
"sessions": sessionsRoute,
"settings/params": paramsRoute,
"stats": statsRoute,
2023-10-23 00:39:01 +00:00
"users": usersRoute,
2023-10-11 01:59:52 +00:00
"workers": workersRoute,
2023-10-09 19:03:31 +00:00
}),
{ filterStatus: (status) => status >= 400 },
);
2023-10-05 09:00:51 +00:00
2023-10-08 21:23:54 +00:00
export type ApiHandler = typeof serveApi;