'Having problem while loading data from server
Access to fetch at 'https://nameless-mesa-03450.herokuapp.com/item' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Solution 1:[1]
Without any code, it is a shot in the dark for us to answer this question. However, this is a common error. In your server side code, import the npm package cors then use it by passing it into the app.use
method of express.
const cors = require('cors')
app.use(cors())
This will work if you are using express on the backend
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | about14sheep |