added health endpoint (#345)
This commit is contained in:
parent
cb04198656
commit
1c1e644ca0
18
pages/api/health.ts
Normal file
18
pages/api/health.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { NextApiRequest, NextApiResponse } from 'next';
|
||||||
|
|
||||||
|
import packageInfo from '../../package.json';
|
||||||
|
|
||||||
|
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||||
|
try {
|
||||||
|
if (req.method !== 'GET') {
|
||||||
|
throw new Error('Method not allowed');
|
||||||
|
}
|
||||||
|
|
||||||
|
res.status(200).json({
|
||||||
|
version: packageInfo.version,
|
||||||
|
});
|
||||||
|
} catch (err: any) {
|
||||||
|
const { statusCode = 503 } = err;
|
||||||
|
res.status(statusCode).json({});
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user