We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f1707bc commit f7db078Copy full SHA for f7db078
apps/cas/backend/src/index.ts
@@ -30,8 +30,12 @@ await app.register(cors, {
30
});
31
32
// ── Auth hook ──────────────────────────────────────────────────────────────
33
-// All /api/* routes require a Bearer token matching CAS_API_KEY.
+// Public routes (no auth required): /health, /api/status
34
+// All other /api/* routes require a Bearer token matching CAS_API_KEY.
35
+const PUBLIC_PATHS = new Set(['/health', '/api/status']);
36
+
37
app.addHook('onRequest', async (request, reply) => {
38
+ if (PUBLIC_PATHS.has(request.url)) return;
39
if (!request.url.startsWith('/api/')) return;
40
if (!API_KEY) return; // auth disabled when key is not set (dev mode)
41
0 commit comments