[Vuejs]-Vue JS and Node(express) js server, No 'Access-Control-Allow-Origin' header is present on the requested resource

-2👍

First install cors if you don’t have it

npm i cors

Then use it in your express app (server.js I suppose)

const cors = require('cors');
app.use(cors({
   origin: ['https://www.example.com']
}));

or

const cors = require('cors');
app.use(cors({
  origin: '*'
}));

Leave a comment