diff --git a/apps/api/src/app.ts b/apps/api/src/app.ts index 958beb1b..802047ea 100644 --- a/apps/api/src/app.ts +++ b/apps/api/src/app.ts @@ -56,6 +56,7 @@ app.use(metricsMiddleware); app.use(express.static('frontend/dist')); // API Routes + app.use('/api', apiRoutes); // Admin dashboard diff --git a/apps/api/src/routes/api.test.ts b/apps/api/src/routes/api.test.ts index 68a2e305..5fb6d5ed 100644 --- a/apps/api/src/routes/api.test.ts +++ b/apps/api/src/routes/api.test.ts @@ -61,6 +61,12 @@ describe('API routes', () => { expect(res.text).toBe('pong'); }); + test('GET /api/hello returns ok true', async () => { + const res = await request(app).get('/api/hello'); + expect(res.status).toBe(200); + expect(res.body).toEqual({ ok: true }); + }); + test('GET /api/version returns build metadata', async () => { const res = await request(app).get('/api/version'); expect(res.status).toBe(200); diff --git a/apps/api/src/routes/api.ts b/apps/api/src/routes/api.ts index ff9f3f27..c857b7f2 100644 --- a/apps/api/src/routes/api.ts +++ b/apps/api/src/routes/api.ts @@ -76,6 +76,12 @@ const apiEndpoints = [ auth: false, description: 'Simple health check (returns "pong")', }, + { + method: 'GET', + path: '/api/hello', + auth: false, + description: 'Hello world test endpoint to verify bot detection', + }, { method: 'GET', path: '/api/version', @@ -273,6 +279,11 @@ router.get('/ping', (_req: Request, res: Response) => { return res.send('pong'); }); +// Hello world test endpoint to verify bot detection +router.get('/hello', (_req: Request, res: Response) => { + return res.status(200).json({ ok: true }); +}); + // Version and build info endpoint router.get('/version', (_req: Request, res: Response) => { return res.json({