tiagosiebler / binance

Node.js & JavaScript SDK for Binance REST APIs & WebSockets, with TypeScript & browser support, integration tests, beautification & more.
https://www.npmjs.com/package/binance
MIT License
778 stars 266 forks source link

CORS w/Unsigned Endpoints #17

Closed GioLogist closed 6 years ago

GioLogist commented 6 years ago

Problem: Because of CORS and Binance's server config, a server is currently required for accessing any endpoint. While this makes total sense for signed endpoints, its a bit overkill for unsigned endpoints (allPrices, etc).

Solution: I see that you guys are running on nginx. You can allow cross origin requests for specific endpoints:

location /api/v1/ticker/allPrices {
        add_header 'Access-Control-Allow-Origin' '*';
}

This will allow people to contribute much simpler apps, widgets, etc. without having to spin up a server instance 🤘🏻

zoeyg commented 6 years ago

You might have better luck contacting binance rather than someone who just wrote a wrapper for their API.

GioLogist commented 6 years ago

@aarongarvey Hah! This is actually a testament to how seamless and well written your wrapper is. I thought it came straight from the source 🤣

Great job, Aaron. I'll shoot Binance an email for the off chance that they open the gates a bit more for us 🤷🏻‍♂️