I'm currently running my payload instance dockerized and I want the container supervisor to check up on the health of the instance, is there any health endpoint on the Payload API?
Definitely not as far as I know, though seems like a useful feature to have
Could probably roll out your own custom endpoint pretty easily though
Nothing built-in currently. But, like Paul said, this would be very simple to do with a custom endpoint.
Here is a simple example. Adding this to your payload config will make a health check endpoint on
/api/health
endpoints: [
{
path: '/health',
method: 'get',
handler: (req, res) => {
res.status(200).send('OK')
},
},
],
Docs:
https://payloadcms.com/docs/rest-api/overview#custom-endpointsYou could use
req.payload
to do some more comprehensive health checks within that function if desired
overrideAccess: true
will likely come in handy in your
req.payload.find
calls or similar.
Cool! Thanks for the clarification!
Star
Discord
online
Get dedicated engineering support directly from the Payload team.