Next.js Discord

Discord Forum

Inject route into next server

Unanswered
West African Lion posted this in #help-forum
Open in Discord
West African LionOP
Hi All,
I was wondering if there's an easier way to inject a route into the next server.
For all our frontends we want to expose a /health endpoint, with some app data e.g. app name, version. Also does the 200 return status indicate the frontend is online for kubernetes.

We currently use a middleware wrapper which check if the incoming route is /health and then returns this data. However this does mean the frontend need to add this wrapper themself in their middelware.ts, but I was wonder if there are other ways (easier ones perhaps through the nextjs config)?

0 Replies