<p>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:</p>

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

<p>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.</p>

<p>Anyone know?</p>

<p>Thanks.</p>

<p>Using an API route is the correct answer. Create a new file in /pages/api called healthcheck.js with this content:</p>
<pre><code>export default function handler(req, res) {
  res.status(200).json({ &quot;status&quot;: &quot;ok&quot; })
}
</code></pre>
<p>The endpoint will be at (hostname)/api/healthcheck</p>
