BackendStack21 / restana

Restana is a lightweight and fast Node.js framework for building RESTful APIs.
MIT License
467 stars 27 forks source link

CORS is missing #116

Closed SuheylZ closed 1 year ago

SuheylZ commented 1 year ago

I could not find any mention of CORS in restana. is there a way I could configure CORS?

jkyberneees commented 1 year ago

Hi @SuheylZ, you can use available plugins, just as in express. See: https://www.npmjs.com/package/cors

npm install cors
const restana = require('restana')
const cors = require('cors')
const app = restana()

app.use(cors())

app.get('/products/:id', (req, res) => {
  res.send({msg: 'This is CORS-enabled for all origins!'})
})

app.start()