feat: GET /health endpoint [bob task 04]
Built by IBM Bob IDE in Agent mode. Clean session: reads only src/routes.ts and its test.
- Actor
- Bob IDE, mode
agent · config 1d321908db2b
- Session
- 94d788ea8a60c055b001b210820462e6 · 26 Sep 2026 13:46 UTC → 26 Sep 2026 13:47 UTC
- Author
- Timotej
- Approver
- bernard · 26 Sep 2026 13:48 UTC
- Tests
- 9 passed · 0 failed
- Record hash
- 12efb0a9908cb69aa02a68af8deddcb7078be8100fb2369e60bc135d430492d2
Read 2
- filesrc/routes.test.ts818f31939d
- filesrc/routes.ts44eafa1d93
Wrote 2
- filesrc/routes.test.ts
- filesrc/routes.ts
Commands 1
Changes
2 file(s)
- Msrc/routes.test.ts
- Msrc/routes.ts
Show diff
diff --git a/src/routes.test.ts b/src/routes.test.ts
index 167d7b7..a60915c 100644
--- a/src/routes.test.ts
+++ b/src/routes.test.ts
@@ -15,6 +15,12 @@ const validBody = {
pan: '4111111111111111',
};
+test('GET /health returns ok', async () => {
+ const res = await request(app).get('/health');
+ expect(res.status).toBe(200);
+ expect(res.body).toEqual({ ok: true });
+});
+
test('POST /payments returns 201 with id', async () => {
const res = await request(app).post('/payments').send(validBody);
expect(res.status).toBe(201);
diff --git a/src/routes.ts b/src/routes.ts
index 6d4e0dd..b5cba47 100644
--- a/src/routes.ts
+++ b/src/routes.ts
@@ -5,6 +5,10 @@ import { Payment } from './types';
const router = Router();
+router.get('/health', (_req: Request, res: Response) => {
+ res.json({ ok: true });
+});
+
router.post('/payments', (req: Request, res: Response) => {
const { merchantId, amountMinor, currency, pan } = req.body as Partial<Payment>;
if (!merchantId || amountMinor === undefined || !currency || !pan) {