From 995c6f90b7859c4759bfe194e014b9b88af8b42e Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Thu, 9 Sep 2021 21:08:34 -0700 Subject: [PATCH] fix: Mount _health route before catch-alls closes #2536 --- server/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/index.js b/server/index.js index 6e658cff3..f7a5b3eb9 100644 --- a/server/index.js +++ b/server/index.js @@ -48,6 +48,10 @@ async function start(id, disconnect) { app.use(compress()); app.use(helmet()); + // install health check endpoint for all services + router.get("/_health", (ctx) => (ctx.body = "OK")); + app.use(router.routes()); + // loop through requestsed services at startup for (const name of serviceNames) { if (!Object.keys(services).includes(name)) { @@ -59,10 +63,6 @@ async function start(id, disconnect) { await init(app, server); } - // install health check endpoint for all services - router.get("/_health", (ctx) => (ctx.body = "OK")); - app.use(router.routes()); - server.on("error", (err) => { throw err; });