Listings is not showing while calling from Backend

Hello
Did any one facing an issue while calling a list from backend ?
I checked Listing API working perfectly fine when I open from separate browser but when I am calling from React Native it showing this error . I believe its some kind of cross site URL calling issue.


You’ll need to configure CORS on the backend. Is this an Express backend? If so, you can follow the steps to install the cors middleware. To summarize…

Install the npm package:

npm install cors

In your app.js (or wherever you have required express), import the cors module:

const cors = require('cors')

And then use it in your express app, which should look something like this:

app.use(cors())

This will enable all CORS requests i.e. your server should now return the Access-Control-Allow-Origin header with the value of *.

Or, you could specifically allow CORS for just your frontend origin:

app.use(cors({ origin: 'http://localhost:19006' }))

2 Likes

Thank you so much it solve the problem :slight_smile: