2
0

🧑‍💻 Add healthcheck API endpoints on all apps (#1563)

fixes #1555
This commit is contained in:
kunal_ingawale
2024-06-11 22:35:12 +05:30
committed by GitHub
parent 2e322c5acc
commit 24db6c5693
6 changed files with 37 additions and 1 deletions

View File

@ -81,8 +81,17 @@ const nextConfig = {
(process.env.NEXT_PUBLIC_POSTHOG_HOST ??
'https://app.posthog.com') + '/:path*',
},
{
source: '/healthz',
destination: '/api/health',
},
]
: [
{
source: '/healthz',
destination: '/api/health',
},
]
: []
},
}

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', timestamp: new Date().toISOString() })
}

View File

@ -159,6 +159,10 @@ const nextConfig = {
destination:
'/api/v1/typebots/:typebotId/blocks/:blockId/storage/upload-url',
},
{
source: '/healthz',
destination: '/api/health',
},
])
.concat(
process.env.NEXTAUTH_URL

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', timestamp: new Date().toISOString() })
}

View File

@ -25,6 +25,14 @@ const nextConfig = {
},
]
},
async rewrites() {
return [
{
source: '/healthz',
destination: '/api/health',
},
]
},
}
export default nextConfig

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', timestamp: new Date().toISOString() })
}