Access to XMLHttpRequest at 'http://localhost:55129/api/GetHomeDetails' from origin 'http://localhost:3000' has been blocked by CORS policy usin react js code example
Example: Access to XMLHttpRequest has been blocked by CORS policy React
/*
npm i cors
or
yarn add cors
then in your node app
*/
const cors = require('cors');
const corsOptions ={
origin:'http://localhost:3000',
credentials:true, //access-control-allow-credentials:true
optionSuccessStatus:200
}
app.use(cors(corsOptions));