1.0.1 • Published 25 days ago

@duplojs/cors v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
25 days ago

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();
1.0.1

25 days ago

1.0.0

3 months ago

0.1.3

5 months ago

0.1.2

5 months ago

0.1.1

6 months ago

0.1.0

6 months ago