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

20 lines
619 B
TypeScript
Raw Normal View History

2023-10-09 19:03:31 +00:00
import { createLoggerMiddleware, createPathFilter } from "t_rest/server";
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-09 19:03:31 +00:00
export const serveApi = createLoggerMiddleware(
createPathFilter({
"jobs": jobsRoute,
"sessions": sessionsRoute,
"users": usersRoute,
"settings/params": paramsRoute,
"stats": statsRoute,
}),
{ 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;