From 0dd2aa17d6e549bc67e988ae3c3c299f3b81bfff Mon Sep 17 00:00:00 2001 From: bipproduction Date: Sat, 7 Feb 2026 15:20:28 +0800 Subject: [PATCH] feat: enable swagger only in development --- src/index.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 1885690..f8dd950 100644 --- a/src/index.ts +++ b/src/index.ts @@ -15,8 +15,10 @@ const api = new Elysia({ prefix: "/api", }) .all("/auth/*", ({ request }) => auth.handler(request)) - .use(cors()) - .use( + .use(cors()); + +if (!isProduction) { + api.use( swagger({ path: "/docs", documentation: { @@ -26,7 +28,10 @@ const api = new Elysia({ }, }, }), - ) + ); +} + +api .get("/session", async ({ request }) => { const data = await auth.api.getSession({ headers: request.headers }); return { data };