📌  相关文章
📜  CORS 策略 React 已阻止访问 XMLHttpRequest - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:18.280000             🧑  作者: Mango

代码示例1
/*
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));