One useful api
This commit is contained in:
parent
4289a9887e
commit
c137ed08f5
@ -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
7
pages/api/ping.ts
Normal 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();
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user