Skip to content
المشاريع

حول

:tada: nextjs-cors is a node.js package to provide a Connect/Express middleware that can be used to enable CORS with various options :rocket:

تطوير الويب والتطبيقات

كيف تُقاس هذه الأرقام

النمو المقاس للنجوم

خلال 24 ساعة
٠
خلال 7 أيام
٠
خلال 15 يومًا
؜-١
خلال شهر
جارٍ جمع السجل

تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.

README.md

الأصل

nextjs-cors

CORS middleware for Next.js API routes.

CI npm version npm downloads license

Installation

npm install nextjs-cors
# or
yarn add nextjs-cors
# or
pnpm add nextjs-cors

Usage

import NextCors from "nextjs-cors";

export default async function handler(req, res) {
  // Run CORS middleware
  await NextCors(req, res, {
    methods: ["GET", "HEAD", "PUT", "PATCH", "POST", "DELETE"],
    origin: "*",
    optionsSuccessStatus: 200,
  });

  // Your API logic
  res.json({ message: "Hello NextJs Cors!" });
}

Options

This package uses the cors package. See the cors documentation for all available options.

License

MIT

استكشف مشاريع مشابهة ومرتبطة

جارٍ التحميل…