add cors
This commit is contained in:
parent
d0acb97e36
commit
364f31066c
4 changed files with 418 additions and 29 deletions
|
@ -1,8 +1,13 @@
|
|||
import NextCors from "nextjs-cors";
|
||||
import { getBorderById } from "../../../lib/borders";
|
||||
|
||||
export default function handler(req, res) {
|
||||
export default async function handler(req, res) {
|
||||
const id = req.query.id;
|
||||
getBorderById(id).then((result) => {
|
||||
return res.status(200).json(result);
|
||||
await NextCors(req, res, {
|
||||
methods: ["GET", "HEAD"],
|
||||
origin: "*",
|
||||
optionsSuccessStatus: 200,
|
||||
});
|
||||
const result = await getBorderById(id);
|
||||
return res.status(200).json(result);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue