chore: setup google & kube z-pages health endpoint

This commit is contained in:
Bart Stefanski 2023-04-21 12:36:14 +02:00
parent bd0886a9b3
commit 9b477aaf92
2 changed files with 13 additions and 0 deletions

View file

@ -10,4 +10,12 @@ const withPlugins = require("next-compose-plugins")
module.exports = withPlugins([[withBundleAnalyzer]], { module.exports = withPlugins([[withBundleAnalyzer]], {
reactStrictMode: true, reactStrictMode: true,
experimental: { instrumentationHook: true }, experimental: { instrumentationHook: true },
rewrites() {
return [
{ source: "/healthz", destination: "/api/health" },
{ source: "/api/healthz", destination: "/api/health" },
{ source: "/health", destination: "/api/health" },
{ source: "/ping", destination: "/api/health" },
]
},
}) })

5
pages/api/health.ts Normal file
View file

@ -0,0 +1,5 @@
import { NextApiRequest, NextApiResponse } from "next"
export default function handler(req: NextApiRequest, res: NextApiResponse) {
res.status(200).json({ status: "ok" })
}