CognxSafeTrack commited on
Commit ·
8577fe3
1
Parent(s): a37c6ef
feat: add /debug/net route to test HF outbound network
Browse files- apps/api/src/index.ts +9 -0
apps/api/src/index.ts
CHANGED
|
@@ -74,6 +74,15 @@ server.get('/', async (_req, reply) => {
|
|
| 74 |
return reply.code(200).type('application/json').send({ ok: true });
|
| 75 |
});
|
| 76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
server.get('/health', async () => {
|
| 78 |
return { status: 'ok', timestamp: new Date().toISOString() };
|
| 79 |
});
|
|
|
|
| 74 |
return reply.code(200).type('application/json').send({ ok: true });
|
| 75 |
});
|
| 76 |
|
| 77 |
+
server.get('/debug/net', async (_req, reply) => {
|
| 78 |
+
try {
|
| 79 |
+
const res = await fetch('https://www.google.com', { method: 'GET' });
|
| 80 |
+
return reply.send({ ok: true, status: res.status });
|
| 81 |
+
} catch (e: any) {
|
| 82 |
+
return reply.code(500).send({ ok: false, error: e?.message || String(e) });
|
| 83 |
+
}
|
| 84 |
+
});
|
| 85 |
+
|
| 86 |
server.get('/health', async () => {
|
| 87 |
return { status: 'ok', timestamp: new Date().toISOString() };
|
| 88 |
});
|