Skip to content

Commit

Permalink
feat: add health endpoint (#341)
Browse files Browse the repository at this point in the history
Because

- We need /health endpoint to facilitate production

This commit

- add health endpoint
  • Loading branch information
EiffelFly committed Feb 12, 2023
1 parent 8c9ee65 commit 488ef16
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/pages/api/health.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { NextApiRequest, NextApiResponse } from "next";

const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const { method } = req;

if (method !== "GET") {
res.setHeader("Allow", ["GET"]);
res.status(405).end(`Method ${method} Not Allowed`);
}

return res.status(200).send("OK");
};

export default handler;

0 comments on commit 488ef16

Please sign in to comment.