diff --git a/auth/src/index.ts b/auth/src/index.ts index 708d91d..c5d2f88 100644 --- a/auth/src/index.ts +++ b/auth/src/index.ts @@ -8,7 +8,7 @@ const handler = toNodeHandler(auth); const server = createServer(async (req, res) => { // Health check - if (req.url === "/health" && req.method === "GET") { + if ((req.url === "/health" || req.url === "/auth/health") && req.method === "GET") { try { const client = await pool.connect(); try { @@ -20,7 +20,7 @@ const server = createServer(async (req, res) => { client.release(); } res.writeHead(200, { "Content-Type": "application/json" }); - res.end(JSON.stringify({ status: "ok", db: "connected" })); + res.end(JSON.stringify({ status: "ok", db: "reachable" })); } catch { res.writeHead(503, { "Content-Type": "application/json" }); res.end(JSON.stringify({ status: "error", db: "unreachable" })); @@ -29,7 +29,10 @@ const server = createServer(async (req, res) => { } // All /auth/* routes handled by Better-Auth - await handler(req, res); + if (req.url?.startsWith("/auth")) { + await handler(req, res); + return; + } }); server.listen(port, "0.0.0.0", () => {