1

HI i m using in my react app axios module and i using to api POST method like this

axios.request({
      method: "POST",
      url,
      responseType: "jsonp",
      data: payload,
      ...config
    });

But i m get error

Access to XMLHttpRequest at 'http://0.0.0.0/api/ak' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. xhr.js:160 POST http://0.0.0.0/api/ak net::ERR_FAILED

please let us know where i m wrong .

Thank for this .

Rohit Azad Malik
  • 30,330
  • 17
  • 61
  • 93

1 Answers1

0

Setup package CORS in your Express server

https://www.npmjs.com/package/cors

Sangam Rajpara
  • 544
  • 2
  • 11