Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/api/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ app.use(metricsMiddleware);
app.use(express.static('frontend/dist'));

// API Routes

app.use('/api', apiRoutes);

// Admin dashboard
Expand Down
6 changes: 6 additions & 0 deletions apps/api/src/routes/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 11 additions & 0 deletions apps/api/src/routes/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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({
Expand Down