@robertoachar/express-cors
v1.0.2
Published
Express Cross-Origin Resource Sharing (CORS) middleware.
Downloads
8
Maintainers
Readme
express-cors
Generated by Node Project Generator.
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
|