Install the CORS package
npm i cors --save
In your server.js:
const cors = require('cors')
....
var corsOptions = {
origin: '*',
optionsSuccessStatus: 200 // some legacy browsers (IE11, various SmartTVs) choke on 204
}
app.use(cors(corsOptions))
app.options('*', cors(corsOptions))