import { Elysia } from "elysia"; import { openapi } from "@elysiajs/openapi"; import { health } from "./routes/health"; import { echo } from "./routes/echo"; const app = new Elysia() .use( openapi({ documentation: { info: { title: "Bun API", version: "1.0.0", description: "A Bun-based API built with Elysia", }, tags: [ { name: "Health", description: "Health check endpoints" }, { name: "Echo", description: "Echo/ping endpoints" }, ], }, }) ) .get("/", () => "Hello Elysia", { detail: { summary: "Root", description: "API root endpoint", tags: ["General"], }, }) .use(health) .use(echo) .listen(3000); console.log( `Elysia is running at http://${app.server?.hostname}:${app.server?.port}` ); console.log( `OpenAPI docs available at http://${app.server?.hostname}:${app.server?.port}/openapi` );