Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/robertoachar/express-cors
Express Cross-Origin Resource Sharing (CORS) middleware.
https://github.com/robertoachar/express-cors
cors express middleware node npm
Last synced: about 2 months ago
JSON representation
Express Cross-Origin Resource Sharing (CORS) middleware.
- Host: GitHub
- URL: https://github.com/robertoachar/express-cors
- Owner: robertoachar
- License: mit
- Created: 2018-02-23T21:53:17.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-18T21:05:43.000Z (over 6 years ago)
- Last Synced: 2024-04-26T16:22:52.849Z (8 months ago)
- Topics: cors, express, middleware, node, npm
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/@robertoachar/express-cors
- Size: 9.77 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# express-cors
Generated by [Node Project Generator](https://github.com/robertoachar/generator-node).
[![NPM Version][npm-badge]][npm-url]
[![License][license-badge]][license-url]> 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
```bash
$ npm i @robertoachar/express-cors
```* Using CORS
```javascript
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
```bash
$ git clone https://github.com/robertoachar/express-cors.git
```* Installing dependencies
```bash
$ npm install
```* Running scripts
| Action | Usage |
| ------------ | -------------- |
| Linting code | `npm run lint` |# Author
[Roberto Achar](https://twitter.com/robertoachar)
# License
[MIT](https://github.com/robertoachar/express-cors/blob/master/LICENSE)
[npm-badge]: https://img.shields.io/npm/v/@robertoachar/express-cors.svg
[npm-url]: https://www.npmjs.com/package/@robertoachar/express-cors
[license-badge]: https://img.shields.io/github/license/robertoachar/express-cors.svg
[license-url]: https://opensource.org/licenses/MIT