cors-magic

1.0.0 • Public • Published

cors-magic

A customizable CORS middleware for Express.js applications.

Installation

npm install cors-magic

Usage

const express = require('express');
const cors = require('cors-magic');

const app = express();

// Default configuration
app.use(cors());

// Custom configuration
app.use(cors({
  origins: ['https://example.com', 'https://anotherdomain.com'],
  methods: ['GET', 'POST'],
  headers: ['Content-Type', 'Authorization'],
  allowCredentials: true
}));

app.listen(3000, () => {
  console.log('Server running on port 3000');
});

Package Sidebar

Install

npm i cors-magic

Weekly Downloads

3

Version

1.0.0

License

MIT

Unpacked Size

2.28 kB

Total Files

3

Last publish

Collaborators

  • wasim-zaman