From 537bc2902adba8f4b8425dd4f62aead32a01eea7 Mon Sep 17 00:00:00 2001 From: wphan Date: Thu, 29 Jun 2023 13:34:10 -0700 Subject: [PATCH] add health check to root --- src/index.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index a2a8adc..68591ec 100644 --- a/src/index.ts +++ b/src/index.ts @@ -374,8 +374,7 @@ const main = async () => { bulkAccountLoader ); - // start http server listening to /health endpoint using http package - app.get('/health', handleResponseTime, async (req, res, next) => { + const handleHealthCheck = async (req, res, next) => { try { if (req.url === '/health') { if (opts.testLiveness) { @@ -451,7 +450,11 @@ const main = async () => { } catch (e) { next(e); } - }); + }; + + // start http server listening to /health endpoint using http package + app.get('/health', handleResponseTime, handleHealthCheck); + app.get('/', handleResponseTime, handleHealthCheck); app.get('/orders/json/raw', handleResponseTime, async (_req, res, next) => { try {