node-XMLHttpRequest icon indicating copy to clipboard operation
node-XMLHttpRequest copied to clipboard

Question

Open Thermatix opened this issue 11 years ago • 2 comments

I'm Building an SDK for the BOX API, But I'd like to be able to use it both for node and for a browser plugin, my question is if I use your library, would I be able to switch to the browser based version with out any or very little in the way of code changes?

It's just I'm using 'request' for node but you can't use that in a browser so I'm wanting to switch to something that will work in both browsers and on node, if your library emulates the browser library, then I'm guessing it follows the same interface as well. would I have much trouble switching between the two? (browser version, your version for node)

Thermatix avatar Apr 14 '14 08:04 Thermatix

Apologies for the self promotion, but I needed the same thing and just put together httpplease. It's just a small wrapper around XMLHttpRequest (it uses this module in node).

Alternatively, there are a few issues (#65, #66) open to add a "browser" field to the package.json which will make this module usable by itself in tools like browserify and webpack, if you want to use XHR directly. @driverdan mentioned that he's going to be going through issues this weekend so it probably won't be too long of a wait.

matthewwithanm avatar Apr 26 '14 17:04 matthewwithanm

sorry, I honestly forgot I had asked this, browserfiy has a version of request for node so I don't think it will be much of an issue to switch, still I will look into this either way, thanks for the info @matthewwithanm.

Thermatix avatar Apr 28 '14 11:04 Thermatix