This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

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

1.0.2 • Public • Published

Koa Cross Origin Resource Sharing

A class for creating Koa middlewares that set CORS headers.

Installation

Install the package with NPM:

npm install @donutteam/koa-cors

Usage

To use this class, simply instantiate an instance and add it to your Koa stack:

import Koa from "koa";

import { CrossOriginResourceSharingMiddleware } from "@donutteam/koa-cors";

const app = new Koa();

const crossOriginResourceSharingMiddleware = new CrossOriginResourceSharingMiddleware();

// Be sure to add the execute function on the instance
// and NOT the instance itself
app.use(crossOriginResourceSharingMiddleware.execute);

Options

allowCredentialsOrigins

This option is simply an array of origins that are allowed to include credentials.

const crossOriginResourceSharingMiddleware = new CrossOriginResourceSharingMiddleware(
	{
		allowCredentialsOrigins:
		[
			"https://donutteam.com",
		],
	});

License

MIT

Package Sidebar

Install

npm i @donutteam/koa-cors

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

7.67 kB

Total Files

8

Last publish

Collaborators

  • duckdotexe