mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-01-18 10:51:28 +00:00
health check moved down
This commit is contained in:
parent
d6e82c8318
commit
14eb96675c
@ -93,7 +93,7 @@ const createServer = (options?) => {
|
||||
res.status(500).send({ status: 'unhealthy', error: err.message })
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// TODO: this exception is required for the graphql playground, since the playground loads external resources
|
||||
// See: https://github.com/graphql/graphql-playground/issues/1283
|
||||
app.use(
|
||||
@ -109,6 +109,16 @@ const createServer = (options?) => {
|
||||
const httpServer = http.createServer(app)
|
||||
server.installSubscriptionHandlers(httpServer)
|
||||
|
||||
// new health check
|
||||
app.get('/api/health', async (req, res) => {
|
||||
try {
|
||||
await serverDatabase.driver.verifyConnectivity()
|
||||
res.status(200).send({ status: 'ok' })
|
||||
} catch (err) {
|
||||
res.status(500).send({ status: 'unhealthy', error: err.message })
|
||||
}
|
||||
})
|
||||
|
||||
return { server, httpServer, app }
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user