1.0.0 • Published 4 months ago

@curveball/cors v1.0.0

Weekly downloads
30
License
MIT
Repository
github
Last release
4 months ago

Curveball CORS middleware

This package is a middleware for the Curveball framework.

Installation

npm install @curveball/cors 

Getting started

After installing the NPM package, simply import the CORS middleware to an existing Curveball server:

import cors from '@curveball/cors';
import { Application } from '@curveball/core';

const app = new Application();
app.use(cors());

When manually providing CORS options, this is how it should look:

app.use(cors({
    allowOrigin: '*',
    allowHeaders: ['Content-Type', 'Accept'],
    allowMethods: ['GET', 'POST'],
    exposeHeaders: ['Link', 'Date'],
    credentials: true
}));

If no options are given, it will use these defaults:

{
    allowOrigin: '*',
    allowHeaders: ['Content-Type', 'User-Agent', 'Authorization', 'Accept', 'Prefer', 'Prefer-Push', 'Link'],
    allowMethods: ['DELETE', 'GET', 'PATCH', 'POST', 'PUT'],
    exposeHeaders: ['Location', 'Link'],
    credentials: false
}
1.0.0

4 months ago

0.3.0

1 year ago

0.2.0

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.0

4 years ago

0.0.1

4 years ago