How to set up an endpoint for Health check on Next.js?

9/16/2019

I have an application deployed on Kubernetes (Google cloud). For the deployment to function, it needs to return a 200 status response to "/healthz" and "/". I have this set up on my Express server as a route returning a response like so:

app.use('/healthz', ((_req, res) => {
      logGeneral.info("Health Status check called.");
      res.sendStatus(200);
    }));

But I don't know how to do the same for my frontend which is running on Next.js / React. Commands such as res.send are not supported.

Anyone know?

Thanks.

-- BURGERFLIPPER101
google-cloud-platform
kubernetes
next.js
reactjs

0 Answers