mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 13:03:50 +00:00

* fix if-else find variables (#92) * fix if-else find variables * change workflow output type * fix tooltip style * fix * 4.8 (#93) * api middleware * perf: app version histories * faq * perf: value type show * fix: ts * fix: Run the same node multiple times * feat: auto save workflow * perf: auto save workflow --------- Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
13 lines
385 B
TypeScript
13 lines
385 B
TypeScript
import type { NextApiResponse, NextApiRequest } from 'next';
|
|
import NextCors from 'nextjs-cors';
|
|
|
|
export async function withNextCors(req: NextApiRequest, res: NextApiResponse) {
|
|
const methods = ['GET', 'eHEAD', 'PUT', 'PATCH', 'POST', 'DELETE'];
|
|
const origin = req.headers.origin;
|
|
await NextCors(req, res, {
|
|
methods,
|
|
origin: origin,
|
|
optionsSuccessStatus: 200
|
|
});
|
|
}
|