skip to Main Content

Im develop a react website with node js backend than react show some error link enter image description here

2

Answers


  1. That’s to do with the backend. Your server isn’t set up to receive requests from the URL you’re using (localhost). If you’re the one writting the server, look up the cors npm package to enable cross site requests. Otherwise, ask whoever is the author of the server.

    Login or Signup to reply.
  2. you are not useing cors or same url for frondend and backend thats why this error coming .For send data frontend to sarver you need use "cors" package.
    install cors:

            npm install cors
    

    then requre it index.js file

            const cors = require('cors')
             app.use(cors())
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search