eris/api/serveApi.ts

33 lines
1.1 KiB
TypeScript
Raw Permalink Normal View History

import { Elysia } from "elysia";
import { swagger } from "elysia/swagger";
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
export const api = new Elysia()
.use(
swagger({
path: "/docs",
swaggerOptions: { url: "docs/json" } as never,
documentation: {
info: { title: "Eris API", version: "0.1" },
servers: [{ url: "/api" }],
},
}),
)
.group("/admins", (api) => api.use(adminsRoute))
.group("/bot", (api) => api.use(botRoute))
.group("/jobs", (api) => api.use(jobsRoute))
.group("/sessions", (api) => api.use(sessionsRoute))
.group("/settings/params", (api) => api.use(paramsRoute))
.group("/stats", (api) => api.use(statsRoute))
.group("/users", (api) => api.use(usersRoute))
.group("/workers", (api) => api.use(workersRoute));
2023-10-05 09:00:51 +00:00
export type Api = typeof api;