personal-site/pages/api/test-route.ts

16 lines
454 B
TypeScript
Raw Normal View History

2023-08-21 08:14:02 +00:00
import { NextApiHandler, NextApiRequest, NextApiResponse } from "next";
/**
* @type {NextApiHandler}
*/
export default function handler(req: NextApiRequest, res: NextApiResponse) {
2023-08-21 08:18:53 +00:00
res.setHeader("Access-Control-Allow-Origin", "*");
2023-08-21 08:22:04 +00:00
res.setHeader("Access-Control-Allow-Methods", "*");
res.setHeader("Access-Control-Allow-Headers", "*");
2023-08-21 08:18:53 +00:00
2023-08-21 08:15:10 +00:00
res.status(200).json({
2023-08-21 08:14:02 +00:00
title: "Hello There",
message: "General Kenobi",
});
}