@robertoachar/express-cors

1.0.2 • Public • Published

express-cors

Generated by Node Project Generator.

NPM Version License

Express Cross-Origin Resource Sharing (CORS) middleware.

This middleware provides the following features:

  • Access-Control-Allow-Origin: *
  • Access-Control-Allow-Methods: GET, POST, PUT, PATCH, DELETE
  • Access-Control-Allow-Headers: Authorization, Content-Type

Usage

  • Install CORS
$ npm i @robertoachar/express-cors
  • Using CORS
const express = require('express');
const cors = require('@robertoachar/express-cors');

const app = express();

app.use(cors());

app.get('/', (req, res) => {
  res.json({ message: 'It works!' });
});

app.listen(3000, () => {
  console.log('Running...');
});

Development

  • Cloning the repo
$ git clone https://github.com/robertoachar/express-cors.git
  • Installing dependencies
$ npm install
  • Running scripts
Action Usage
Linting code npm run lint

Author

Roberto Achar

License

MIT

Package Sidebar

Install

npm i @robertoachar/express-cors

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

4.02 kB

Total Files

5

Last publish

Collaborators

  • robertoachar