All Projects → yonycalsin → nextjs-cors

yonycalsin / nextjs-cors

Licence: MIT License
🎉 nextjs-cors is a node.js package to provide a Connect/Express middleware that can be used to enable CORS with various options 🚀

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to nextjs-cors

jeffjadulco.com
👽 Personal website running on Next.js
Stars: ✭ 54 (-44.33%)
Mutual labels:  nextjs
twitch-chat-visualizer
A Node.js Project. Would you like to see your chat stream with a custom design? This is for you!
Stars: ✭ 14 (-85.57%)
Mutual labels:  cors
netease-music-app
网易云音乐移动端【React/Next/Vue】【Ant Design/Material UI】
Stars: ✭ 95 (-2.06%)
Mutual labels:  nextjs
nextjs-redux-authentication-boilerplate
NextJS app with Redux based authentication (via OAuth2).
Stars: ✭ 38 (-60.82%)
Mutual labels:  nextjs
Personal-Site-Gourav.io
My personal site & blog made with NextJS, Typescript, MDX, Tailwind CSS. Deployed on Vercel : https://gourav.io
Stars: ✭ 64 (-34.02%)
Mutual labels:  nextjs
uploading-files-react-node
Uploading files with React.js and Node.js
Stars: ✭ 33 (-65.98%)
Mutual labels:  nextjs
Void
Fast and elegant file hosting service.
Stars: ✭ 48 (-50.52%)
Mutual labels:  nextjs
nextal
Starter template for NextJs with TypeScript. Supports Tailwind with CSS-Modules. Jest and @react/testing-library configured and ready to go. Also ESLint, Prettier, Husky, Commit-lint and Atomic Design for components.
Stars: ✭ 88 (-9.28%)
Mutual labels:  nextjs
next-plugin-preval
Pre-evaluate async functions during builds and import them like JSON
Stars: ✭ 174 (+79.38%)
Mutual labels:  nextjs
crusher
Develop.Test. Ship.🦖 Open source e2 low-code web testing. Blazing fast alternative to Selenium, Cypress.
Stars: ✭ 148 (+52.58%)
Mutual labels:  nextjs
onlysetups
OnlyFans, but for pictures of desk setups.
Stars: ✭ 82 (-15.46%)
Mutual labels:  nextjs
snipcart-nextjs
Demo code for a Next.js e-commerce app powered by Snipcart
Stars: ✭ 116 (+19.59%)
Mutual labels:  nextjs
Microservices-Nodejs-React
Applying Microservices Architecture using nodejs, MongoDB, redis, and handling async communication using nats. Deploying all these in a kubernetes cluster hosted on gcp.
Stars: ✭ 18 (-81.44%)
Mutual labels:  nextjs
RocketLaunches
Rocket launches, a simple site to let you know what is the next rocket launch.
Stars: ✭ 13 (-86.6%)
Mutual labels:  nextjs
next-saga-example
Example of using next.js with redux saga
Stars: ✭ 24 (-75.26%)
Mutual labels:  nextjs
Kobra
Kobra is a visual programming language (like Scratch) for Machine Learning (currently under active development).
Stars: ✭ 223 (+129.9%)
Mutual labels:  nextjs
carloscuesta.me
The source of my website 🌍
Stars: ✭ 38 (-60.82%)
Mutual labels:  nextjs
personal-blog
✍️ 个人技术博客
Stars: ✭ 79 (-18.56%)
Mutual labels:  nextjs
devdevdev
The next trendy apparel e-commerce store maybe?
Stars: ✭ 27 (-72.16%)
Mutual labels:  nextjs
tweet-to-image
Convert tweets to beautiful images
Stars: ✭ 134 (+38.14%)
Mutual labels:  nextjs

Nextjs Cors

Nextjs-Cors is a node.js package to provide a middleware that can be used to enable CORS with various options in nextjs applications.

CI NPM Version Package License NPM Downloads

Installation

First we will have to install, in order to use this wonderful package.

# Using npm
npm install --save nextjs-cors@latest

# Using yarn
yarn add nextjs-cors@latest

Usage

nextjs-cors uses the cors package, so we invite you to check the documentation https://github.com/expressjs/cors

pages/api/whoami.{ts,js}

import NextCors from 'nextjs-cors';

async function handler(req, res) {
   // Run the cors middleware
   // nextjs-cors uses the cors package, so we invite you to check the documentation https://github.com/expressjs/cors
   await NextCors(req, res, {
      // Options
      methods: ['GET', 'HEAD', 'PUT', 'PATCH', 'POST', 'DELETE'],
      origin: '*',
      optionsSuccessStatus: 200, // some legacy browsers (IE11, various SmartTVs) choke on 204
   });

   // Rest of the API logic
   res.json({ message: 'Hello NextJs Cors!' });
}

Support for

nextjs-cors is an open source project licensed by MIT. You can grow thanks to the sponsors and the support of the amazing sponsors. If you want to join them, contact me here.

Stay in touch

Contributors

Thanks to the wonderful people who collaborate with me !

License

nextjs-cors under License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].