airbnb / hypernova

A service for server-side rendering your JavaScript views
MIT License
5.82k stars 208 forks source link

add health check endpoint (/) #74

Closed gfx closed 7 years ago

gfx commented 7 years ago

We currently check the hypernova process by pid, but sometimes hypernova does not work even if the process lives.

This PR mount / as a health check endpoint to check the server is working or not.

What do you think of it?

magicmark commented 7 years ago

the hypernova function returns the express app object, so you could just add additional endpoints there

fwiw this is what I also do. this does tie us to an implementation detail of hypernova though, so I'm +1 for a built in healthcheck option if it's useful to more people?

goatslacker commented 7 years ago

I think this should be at the discretion of the user. You can currently do this by:

hypernova(hypernovaOptions, (app) => {
  app.get('/health', (req, res) => res.send(Date.now()))
})
gfx commented 7 years ago

Thanks, everyone. I agree with @goatslacker, "different folks will have different requirements".

I hope README.md shows how to add health check endpoints, which seems the best way on it.