Skip to content

Latest commit

 

History

History
38 lines (30 loc) · 510 Bytes

README.md

File metadata and controls

38 lines (30 loc) · 510 Bytes

@qiwi/mware-cors

CORS middleware

Install

yarn add @qiwi/mware-cors
npm i @qiwi/mware-cors

Usage

import cors from '@qiwi/mware-cors'
import express from 'express'

const app = express()
app.use(cors())

app.get('/foo/bar', (req, res) => {
  res.send('foo')
})

/*
 RES {
  headers: { 
    'Access-Control-Allow-Origin': '*',
    'Access-Control-Allow-Methods': 'GET, HEAD, PATCH, PUT, POST, DELETE, OPTIONS'
    ...
  },
  ...
 }
 */

app.listen(...)

License

MIT