How to make XHR calls to back-end server with proper cross-origin policy?


#1

Is there a document goes into detail on how to make XHR request from your front-end to your back-end server? I especially need to know how to set things up so I don’t get cross-origin errors between the twitch.tv domain hosting my front and my back-end service domain, when I make XHR calls to my server.

I looked here under the Extensions documentation, but I don’t see anything about that. (Sorry if I missed it):


#2

Thanks to the fine folk on the Discord I got this working right. For other Node.JS devs out there facing the same issue, just use the cors NPM package and follow this document:

https://expressjs.com/en/resources/middleware/cors.html

My extension now works in hosted mode.