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

1.0.1 • Public • Published

duplojs-cors

NPM version

Instalation

npm i @duplojs/cors

Utilisation

Global:

import Duplo from "@duplojs/duplojs";
import duploCors from "@duplojs/cors";

const duplo = Duplo({port: 1506, host: "localhost", environment: "DEV"});
duplo.use(duploCors, {
    allowOrigin: "localhost",
    allowHeaders: ["content-type", "accept"],
    allowMethods: true,
    credentials: true,
    exposeHeaders: ["info"],
    maxAge: 0,
});

// declare routes ...

duplo.launch();

Local:

import Duplo from "@duplojs/duplojs";
import {duploCorsAbstract} from "@duplojs/cors";

const duplo = Duplo({port: 1506, host: "localhost", environment: "DEV"});
const abstractCors = duplo.use(duploCorsAbstract, {
    allowOrigin: "localhost",
    allowHeaders: ["content-type", "accept"],
    allowMethods: true,
    credentials: true,
    exposeHeaders: ["info"],
    maxAge: 0,
});

// declare routes with abstract route ...
abstractCors.declareRoute("GET", "/")
.handler((floor, response) => {
    response.code(200).info("successful").send();
});

duplo.launch();

Readme

Keywords

none

Package Sidebar

Install

npm i @duplojs/cors

Weekly Downloads

0

Version

1.0.1

License

ISC

Unpacked Size

25.3 kB

Total Files

13

Last publish

Collaborators

  • mathcovax