feat(medusa): Add health endpoint for all running modes of medusa (#10737)

This commit is contained in:
Stevche Radevski
2024-12-26 13:53:12 +08:00
committed by GitHub
parent 699bb6dc24
commit c8f9938865
2 changed files with 6 additions and 4 deletions

View File

@@ -95,10 +95,6 @@ export async function expressLoader({ app }: { app: Express }): Promise<{
// Currently we don't allow configuration of static files, but this can be revisited as needed.
app.use("/static", express.static(path.join(baseDir, "static")))
app.get("/health", (req, res) => {
res.status(200).send("OK")
})
const shutdown = async () => {
redisClient?.disconnect()
}

View File

@@ -138,6 +138,12 @@ async function start(args: {
}
const serverActivity = logger.activity(`Creating server`)
// Register a health check endpoint. Ideally this also checks the readiness of the service, rather than just returning a static response.
app.get("/health", (_, res) => {
res.status(200).send("OK")
})
const server = GracefulShutdownServer.create(
http_.listen(port, host).on("listening", () => {
logger.success(