Skip to content

Commit

Permalink
Configure healthcheck endpoint rewrite path
Browse files Browse the repository at this point in the history
  • Loading branch information
trottomv committed Jan 10, 2024
1 parent 976536e commit 9565231
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions {{cookiecutter.project_dirname}}/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ const nextjsConfig = {
output: 'standalone',
reactStrictMode: true,
swcMinify: true,
rewrites: async () => [
{
source: '/{{ cookiecutter.service_slug }}/health',
destination: '/api/health'
},
]
}

// Sentry config. For all available options, see:
Expand Down
4 changes: 2 additions & 2 deletions {{cookiecutter.project_dirname}}/pages/api/health.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { NextApiRequest, NextApiResponse } from 'next'
import type { NextApiRequest, NextApiResponse } from 'next/types'

export default function handler(_req: NextApiRequest, res: NextApiResponse) {
res.status(200).json({ status: 'ok' })
res.status(204).send('')
}

0 comments on commit 9565231

Please sign in to comment.