New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make reqwest client/server agnostic #153
Comments
Started working on it here: |
+1 |
Ran into this same issue when prerendering a react page that used reqwest, being able to be used in node would be a huge plus. |
@markbahnman The fork I linked above has been working for me. |
@appsforartists @alexaivars @markbahnman Go ahead and look at the source for https://github.com/mikeal/request and you'll see it solves a number of other problems that this library doesn't even attempt to address. And visa/versa. |
@ded I haven't looked through request much, but if xhr2 continues to work as-advertised, that should polyfill all you need to worry about for the HTTP layer in Node. Then, it's just a matter of being careful about not-presuming that browser properties are global. As you can see, the footprint of appsforartists@796d511 is pretty damn small. It's your library. You've spent a lot of more time than I have thinking about these things, and I'm certainly not going to tell you what to support, but are you amenable to something like appsforartists@796d511 to enable reqwest to be used in isomorphic apps (if the node-implementation can be offloaded to a polyfill like xhr2)? The apps I'm working on nowadays use identical code on the client and server, so using two different libraries for data is really unappealing. If we could make reqwest isomorphic without bloating or wholesale rewriting, that would be awesome! Also interesting to note, @mjackson's mach is aiming to be the end-all http library for JS, equally adept at the client and server. However, I don't think the client story has been fleshed out yet. |
+1 for agnosticism. (in this context) |
+1 right now, I can't use the library with reactjs,net without a hassle. |
@appsforartists could you put in a pull request for this issue? Isomorphic apps are becoming more and more popular, so being able to include this dependency in webpack is pretty important. I don't want to have to hack together two different versions of my javascript more than I need to. |
@raysuelzer sure. FWIW, I use mach now, which is agnostic. If you're feeling future-proof, there's also fetch. |
@raysuelzer I don't know if @ded is interested, but there's now a PR open at #185. |
@appsforartists thanks for doing that! Hopefully @ded is interested. |
+1 for reqwest in isomorphic apps |
1 similar comment
+1 for reqwest in isomorphic apps |
+1 |
alright this is officially on the radar. i'll have a look at that open PR as well! |
@appsforartists @blainekasten @raysuelzer @luandro @yicone Thanks tons for being patient on this! Given the high level of interest on this, and taking into account the history of this project, we'll have to consider a solution that continues to support the original purpose (the browser) and somehow add a peer dependency for Node.js (like the In the meantime, I'll try and have a play with a solution |
Right now, trying to use reqwest from Node results in this error:
Given that there are projects to provide the XHR interface in Node, making reqwest isomorphic should be as simple as abstracting out the implicit use of globals like
window
anddocument
.The text was updated successfully, but these errors were encountered: