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

22 lines
698 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-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({
"jobs": jobsRoute,
"sessions": sessionsRoute,
"users": usersRoute,
"settings/params": paramsRoute,
"stats": statsRoute,
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;