1.0.0 • Published 12 months ago

cors-magic v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

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');
});