@shise/cors
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

CORS Middleware

A middleware for handling Cross-Origin Resource Sharing (CORS) in your web server.

Installation

npm install @shise/cors

Usage

const cors, { CorsOptions } = require('@shise/cors')
const { Controller } = require('shise')

const controller = new Controller()
controller.use(cors(/* optional CorsOptions */))

Options

allowedOrigins (optional): Array of allowed origins. Default is an empty array. allowedMethods (optional): Array of allowed HTTP methods. Default is ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS']. allowedHeaders (optional): Array of allowed headers. Default is an empty array. exposedHeaders (optional): Array of headers exposed to the client. Default is an empty array. maxAge (optional): The maximum time (in seconds) that a preflight request may be cached. Default is 600. credentials (optional): Boolean indicating whether credentials (e.g., cookies) should be included. Default is false.

License

MIT

Package Sidebar

Install

npm i @shise/cors

Weekly Downloads

1

Version

0.0.3

License

MIT

Unpacked Size

5.34 kB

Total Files

6

Last publish

Collaborators

  • aizawa-san