borders/pages/api/border/[id].js

14 lines
364 B
JavaScript
Raw Normal View History

2022-05-01 22:19:46 +00:00
import NextCors from "nextjs-cors";
2022-04-11 17:33:16 +00:00
import { getBorderById } from "../../../lib/borders";
2022-05-01 22:19:46 +00:00
export default async function handler(req, res) {
2022-04-16 22:29:21 +00:00
const id = req.query.id;
2022-05-01 22:19:46 +00:00
await NextCors(req, res, {
methods: ["GET", "HEAD"],
origin: "*",
optionsSuccessStatus: 200,
2022-04-16 22:29:21 +00:00
});
2022-05-01 22:19:46 +00:00
const result = await getBorderById(id);
return res.status(200).json(result);
2022-04-16 22:29:21 +00:00
}