Nice Package, Mate

    @donutteam/koa-cors

    1.0.1 • 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

    Install

    npm i @donutteam/koa-cors

    DownloadsWeekly Downloads

    2

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    4.55 kB

    Total Files

    5

    Last publish

    Collaborators

    • duckdotexe