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

16 lines
492 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", "*");
res.setHeader("Access-Control-Allow-Methods", "GET,OPTIONS");
res.setHeader("Access-Control-Allow-Headers", "X-Requested-With,content-type");
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",
});
}