One useful api

This commit is contained in:
Daniel Kluge 2022-01-12 19:54:29 +01:00
parent 4289a9887e
commit c137ed08f5
2 changed files with 7 additions and 13 deletions

View File

@ -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<Data>
) {
res.status(200).json({ name: "John Doe" });
}

7
pages/api/ping.ts Normal file
View File

@ -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<string>) {
res.status(200).send("Pong!");
res.end();
}