</>PackageGraphPackageGraph

cors

npmv2.8.6

Node.js CORS middleware

Safe to adopt

Yes — cors scores well across adoption, maintenance, weight, supply chain, and licensing. 69.7M downloads per week and 6 known dependents. Last published 230 days ago.

  • AAdoption: grade A, Excellent.

    69.7M downloads per week and 6 known dependents.

  • BMaintenance: grade B, Good.

    Last published 230 days ago.

  • AWeight: grade A, Excellent.

    Pulls in 2 transitive packages, about 19 KB installed (at least — some of the tree is still being crawled).

  • ASupply chain: grade A, Excellent.

    No install scripts, 3 maintainers, and a contained dependency surface.

  • ALicense: grade A, Excellent.

    MIT — permissive, with no copyleft found in the dependency tree.

Grades are computed deterministically from registry metadata collected by PackageGraph — downloads, dependents, publish dates, the resolved dependency tree, maintainer count, and declared licenses. No third-party scores are used.

Install cost

What you actually take on by adding cors to a project.

2
Direct dependencies

Runtime packages this one declares itself.

2
Total installed

Distinct packages in the full runtime tree, deduplicated the way a package manager would.

19 KB
Install size

Unpacked size of this package plus its entire runtime tree.

1
Tree depth

Longest resolved dependency chain below this package.

Part of this dependency tree has not been crawled yet, so these figures are a lower bound rather than a final total.

Licenses in the dependency tree

MIT

Every license you inherit by installing cors, not just its own. Check this before a legal review, not after.

Compatibility

Node.js
node >= 0.10
Module format
CommonJS only
TypeScript
No bundled types
Install scripts
None

Quick start

A usage example from the cors README.

javascriptFull README ↗
var express = require('express')
var cors = require('cors')
var app = express()

// Adds headers: Access-Control-Allow-Origin: *
app.use(cors())

app.get('/products/:id', function (req, res, next) {
  res.json({msg: 'Hello'})
})

app.listen(80, function () {
  console.log('web server listening on port 80')
})

cors vs the alternatives

Packages solving a similar problem in the npm ecosystem, compared on the signals that drive an adoption decision.

PackageWeekly downloadsDependentsLicenseLast release
corsthis page69.7M6MIT7 months ago
express-rate-limit02MIT1 day ago
nocache01MIT1 day ago
connect07MIT1 day ago
express92.8M17MIT1 day ago
get-port17M1MIT1 day ago

Dependencies

Declared by cors v2.8.6. Runtime dependencies are installed with the package; dev dependencies are not.

Runtime (2)

object-assign ^4vary ^1

Dev (6)

after 0.8.2eslint 7.30.0express 4.21.2mocha 9.2.2nyc 15.1.0supertest 6.1.3

Used by

Popular packages that depend on cors.

Relationship graph

Dependencies (left) and dependents (right) of cors.

Frequently installed together

Release history

1 release in the last two years, typically about 31 days apart.

Recent versions of cors
VersionPublishedSizeLicense
2.8.6latest7 months ago19 KBMIT
2.8.57 years ago20 KBMIT
2.8.49 years agoMIT
2.8.39 years agoMIT
2.8.29 years agoMIT
2.8.110 years agoMIT
2.8.010 years agoMIT
2.7.210 years agoMIT
2.7.111 years agoMIT
2.7.011 years agoMIT
2.6.111 years agoMIT
2.6.011 years agoMIT
2.5.311 years agoMIT
2.5.212 years agoMIT
2.5.112 years agoMIT

Overview

cors is an npm package that node.js CORS middleware. It is extremely widely used, with about 69.7M downloads per week and 6 known dependents in the graph. The latest version is 2.8.6, released under the MIT license.

Who should use it

Teams working in the npm ecosystem who need node.js CORS middleware and value a battle-tested, widely-adopted solution.

When not to use it

Consider an alternative if you need to have first-class TypeScript types out of the box, or if a more actively-maintained option better fits your npm stack.

Pros

  • Large, well-established user base (69.7M weekly downloads).
  • Clear open-source license (MIT).

Cons

  • No bundled TypeScript types (may require a separate @types package).

Auto-generated from collected registry metadata. No external claims are inferred.

Maintainers

Keywords

Funding

Frequently asked questions

Should I use cors?

Yes — cors scores well across adoption, maintenance, weight, supply chain, and licensing. 69.7M downloads per week and 6 known dependents. Last published 230 days ago.

How do I install cors?

Run `npm install cors` to add cors to your npm project.

How many dependencies does cors have?

cors declares 8 direct dependencies and pulls in 2 packages in total once its runtime tree is resolved totalling about 19 KB on disk.

What license is cors released under?

cors is distributed under the MIT license.

How popular is cors?

cors has approximately 69,729,609 downloads per week and 6 known dependent packages.

Is cors still maintained?

The most recent release of cors (v2.8.6) was published 7 months ago.

Does cors run install scripts?

No. cors does not define preinstall, install, or postinstall scripts, so installing it does not execute publisher-supplied code.