{"id":19646972,"url":"https://github.com/yonycalsin/nextjs-cors","last_synced_at":"2025-04-12T17:43:21.871Z","repository":{"id":37998999,"uuid":"286116805","full_name":"yonycalsin/nextjs-cors","owner":"yonycalsin","description":":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:","archived":false,"fork":false,"pushed_at":"2024-07-17T01:07:40.000Z","size":874,"stargazers_count":226,"open_issues_count":4,"forks_count":8,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T19:15:19.757Z","etag":null,"topics":["cors","express-cors","http-cors","nextjs","nextjs-cors","node-nextjs-cors"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yonycalsin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-08T20:45:18.000Z","updated_at":"2025-02-20T14:28:26.000Z","dependencies_parsed_at":"2024-06-18T13:53:30.813Z","dependency_job_id":"63405f1e-9d40-4cb4-bdde-a4dc156ace8c","html_url":"https://github.com/yonycalsin/nextjs-cors","commit_stats":{"total_commits":105,"total_committers":9,"mean_commits":"11.666666666666666","dds":"0.37142857142857144","last_synced_commit":"b301db96a659db3cb1046819f63337e27617d258"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yonycalsin%2Fnextjs-cors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yonycalsin%2Fnextjs-cors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yonycalsin%2Fnextjs-cors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yonycalsin%2Fnextjs-cors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yonycalsin","download_url":"https://codeload.github.com/yonycalsin/nextjs-cors/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248608682,"owners_count":21132763,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cors","express-cors","http-cors","nextjs","nextjs-cors","node-nextjs-cors"],"created_at":"2024-11-11T14:41:43.488Z","updated_at":"2025-04-12T17:43:21.849Z","avatar_url":"https://github.com/yonycalsin.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nextjs Cors\n\n`Nextjs-Cors` is a node.js package to provide a middleware that can be used to enable CORS with various options in nextjs applications.\n\n[![CI](https://github.com/yonycalsin/nextjs-cors/actions/workflows/ci.yml/badge.svg)](https://github.com/yonycalsin/nextjs-cors/actions/workflows/ci.yml)\n\u003ca href=\"https://github.com/yonycalsin/nextjs-cors\"\u003e\u003cimg src=\"https://img.shields.io/spiget/stars/1000?color=brightgreen\u0026label=Star\u0026logo=github\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/nextjs-cors\" target=\"_blank\"\u003e\n\u003cimg src=\"https://img.shields.io/npm/v/nextjs-cors\" alt=\"NPM Version\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/nextjs-cors\" target=\"_blank\"\u003e\n\u003cimg src=\"https://img.shields.io/npm/l/nextjs-cors\" alt=\"Package License\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/nextjs-cors\" target=\"_blank\"\u003e\n\u003cimg src=\"https://img.shields.io/npm/dm/nextjs-cors\" alt=\"NPM Downloads\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/yonycalsin/nextjs-cors\"\u003e\u003cimg src=\"https://img.shields.io/badge/Github%20Page-nextjs.cors-yellow?style=flat-square\u0026logo=github\" /\u003e\u003c/a\u003e\n\n## Installation\n\n\u003e First we will have to install, in order to use this wonderful package.\n\n```bash\n# Using npm\nnpm install nextjs-cors@latest\n\n# Using yarn\nyarn add nextjs-cors@latest\n\n# Using pnpm\npnpm add nextjs-cors@latest\n```\n\n## Usage\n\nnextjs-cors uses the cors package, so we invite you to check the documentation https://github.com/expressjs/cors\n\n\u003e pages/api/whoami.{ts,js}\n\n```ts\nimport NextCors from 'nextjs-cors';\n\nasync function handler(req, res) {\n   // Run the cors middleware\n   // nextjs-cors uses the cors package, so we invite you to check the documentation https://github.com/expressjs/cors\n   await NextCors(req, res, {\n      // Options\n      methods: ['GET', 'HEAD', 'PUT', 'PATCH', 'POST', 'DELETE'],\n      origin: '*',\n      optionsSuccessStatus: 200, // some legacy browsers (IE11, various SmartTVs) choke on 204\n   });\n\n   // Rest of the API logic\n   res.json({ message: 'Hello NextJs Cors!' });\n}\n```\n\n## License\n\n`nextjs-cors` under [License.](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyonycalsin%2Fnextjs-cors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyonycalsin%2Fnextjs-cors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyonycalsin%2Fnextjs-cors/lists"}