Install package:
npm i cors
Install typings if using TypeScript:
npm i --save-dev @types/cors
Enable middleware:
import express from 'express'
import cors from 'cors'
const app = express()
app.use(cors({ origin: '<front-end-url>' }))
Install package:
npm i cors
Install typings if using TypeScript:
npm i --save-dev @types/cors
Enable middleware:
import express from 'express'
import cors from 'cors'
const app = express()
app.use(cors({ origin: '<front-end-url>' }))