Skip to main content

farrow-cors

Cross-Origin Resource Sharing(CORS) for farrow-http.

Installation

This is a Node.js module available through the npm registry.

yarn add farrow-cors

Usage

import { Http, Response } from "farrow-http";
import { cors } from "farrow-cors";

const http = Http();

http.use(cors());

http
.match({
pathname: "/product/:id",
params: {
id: Number,
},
})
.use(() => {
return Response.json({ msg: "This is CORS-enabled for all origins!" });
});

http.listen(80, function () {
console.log("CORS-enabled web server listening on port 80");
});

Options

See expressjs/cors.

Learn More

Relative Module