app.ts
Raw
1import path from "node:path";
2import { staticPlugin } from "@elysiajs/static";
3import { Elysia } from "elysia";
4import config from "./config.ts";
5import { authRoutes } from "./routes/auth.tsx";
6import { avatarRoutes } from "./routes/avatars.ts";
7import { gitRoutes } from "./routes/git.ts";
8import { issueRoutes } from "./routes/issues.tsx";
9import { patchRoutes } from "./routes/patches.tsx";
10import { releasesRoutes } from "./routes/releases.tsx";
11import { repoRoutes } from "./routes/repos.tsx";
12import { settingsRoutes } from "./routes/settings.tsx";
13import { syncStartup } from "./services/repoSync.ts";
14
15export async function createApp(port: number) {
16 await syncStartup();
17 return new Elysia({
18 serve: { maxRequestBodySize: config.MAX_UPLOAD_BYTES },
19 })
20 .use(
21 staticPlugin({
22 assets: path.resolve("./public"),
23 prefix: "/",
24 }),
25 )
26 .use(gitRoutes)
27 .use(settingsRoutes)
28 .use(authRoutes)
29 .use(repoRoutes)
30 .use(issueRoutes)
31 .use(patchRoutes)
32 .use(releasesRoutes)
33 .use(avatarRoutes)
34 .listen(port);
35}
36