From c512e50ac8355690d25e99170bd39c3a0c038b4e Mon Sep 17 00:00:00 2001 From: Jason Efstathiou Date: Wed, 16 Oct 2024 12:52:21 +0200 Subject: [PATCH] assertStarted in health endpoint --- src/server.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/server.ts b/src/server.ts index 12943d3..8be380c 100644 --- a/src/server.ts +++ b/src/server.ts @@ -120,6 +120,13 @@ const startServer = async () => { app.set('trust proxy', 1); app.route('/health').get((_, res) => { + try { + server.assertStarted('/health'); + } catch (error) { + res.status(500).send('Server not ready'); + return; + } + res.status(200).send('OK'); });