From c137ed08f5815edc1a182ab6cd04a10b6054ea68 Mon Sep 17 00:00:00 2001 From: Daniel Kluge Date: Wed, 12 Jan 2022 19:54:29 +0100 Subject: [PATCH] One useful api --- pages/api/hello.ts | 13 ------------- pages/api/ping.ts | 7 +++++++ 2 files changed, 7 insertions(+), 13 deletions(-) delete mode 100644 pages/api/hello.ts create mode 100644 pages/api/ping.ts diff --git a/pages/api/hello.ts b/pages/api/hello.ts deleted file mode 100644 index 941d4fa..0000000 --- a/pages/api/hello.ts +++ /dev/null @@ -1,13 +0,0 @@ -// Next.js API route support: https://nextjs.org/docs/api-routes/introduction -import type { NextApiRequest, NextApiResponse } from "next"; - -type Data = { - name: string -} - -export default function handler( - req: NextApiRequest, - res: NextApiResponse -) { - res.status(200).json({ name: "John Doe" }); -} diff --git a/pages/api/ping.ts b/pages/api/ping.ts new file mode 100644 index 0000000..cfdba75 --- /dev/null +++ b/pages/api/ping.ts @@ -0,0 +1,7 @@ +// Next.js API route support: https://nextjs.org/docs/api-routes/introduction +import type { NextApiRequest, NextApiResponse } from "next"; + +export default function handler(_req: NextApiRequest, res: NextApiResponse) { + res.status(200).send("Pong!"); + res.end(); +}