
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
cors-express2
Advanced tools
Express middleware to enable cross origin resource sharing on a route
A simple Express middleware to enable cross origin resource sharing on a route. It will deals with access-control-allow-origin
, access-control-allow-credentials
, access-control-request-headers
and access-control-allow-methods
headers. OPTIONS
preflight requests will be directly answered with a HTTP 200 - OK
.
var Express = require('express');
var cors = require('cors');
var app = Express();
express.use(cors({
allowWithoutOrigin: true,
onlyAllowedOrigin: true,
allowCredentials: true,
allowedOrigins: [
'http://127.0.0.1:8181',
'http://localhost:8181'
],
nullOrigin: 'null'
}));
allowWithoutOrigin
: if true
, allow requests without origin, setting access-control-allow-origin=*
onlyAllowedOrigin
: if true
, requires the origin to be in the list of allowed originsallowCredentials
: if true
, will set access-control-allow-credentials=true
allowedOrigins
: an array of string representing the allowed originsnullOrigin
: set the string corresponding to null
origin, most likely the default will always be okFAQs
Express middleware to enable cross origin resource sharing on a route
The npm package cors-express2 receives a total of 2 weekly downloads. As such, cors-express2 popularity was classified as not popular.
We found that cors-express2 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.