Any Node.js HTTP request module that works in both server and browser when bundled with Webpack?

I need a request module that runs on both the Node.js server and the client, bundled with Webpack.

My requirements are really basic. I just need to do some Ajax HTTP requests like get

and post

. Automatic JSON parsing would be awesome.

I'm looking at Request , which seems solid on the number of commits and downloads, but the site doesn't indicate if it works bundled in a browser.

Any suggestion?

+3


source to share


2 answers


I am using axios

Promise based HTTP client for browser and node.js



Functions

  • Make XMLHttpRequests in browser
  • Make http requests from node.js
  • Promise API support
  • Intercept request and response
  • Transformation request and response data
  • Cancel requests
  • Automatic conversions for JSON data
  • Client side support for XSRF protection
+3


source


Try SuperAgent

SuperAgent is a small progressive HTTP client library , and Node.js with the same API




Works with browser and works with webpack

+2


source







All Articles