pingql/apps/web/src/index.ts

23 lines
707 B
TypeScript

import { Elysia } from "elysia";
import { cors } from "@elysiajs/cors";
import { swagger } from "@elysiajs/swagger";
import { checks } from "./routes/checks";
import { monitors } from "./routes/monitors";
import { auth } from "./routes/auth";
import { internal } from "./routes/internal";
import { migrate } from "./db";
await migrate();
const app = new Elysia()
.use(cors())
.use(swagger({ path: "/docs", documentation: { info: { title: "PingQL API", version: "0.1.0" } } }))
.get("/", () => ({ name: "PingQL", version: "0.1.0", docs: "/docs" }))
.use(auth)
.use(monitors)
.use(checks)
.use(internal)
.listen(3000);
console.log(`PingQL running at http://localhost:${app.server?.port}`);