I was looking for modern modules that implement basic HTTP methods such as GET, POST in Node.js.
I guess the most popular is request
. The async/await version of it is called request-promise-native
.
Recently I learned that these modules are being deprecated. So, what modern alternatives can I use that are built on the async/await paradigm?
Got is pretty sweet.
"Got was created because the popular request package is bloated. Furthermore, Got is fully written in TypeScript and actively maintained." - https://www.npmjs.com/package/got#faq
I'd strongly suggest using node-fetch. It is based on the fetch API in modern browsers. Not only is it promise-based it also has an actual standard behind it.
The only reason you wouldn't use fetch
is if you don't like the API. Then I'd suggest using something cross-platform like axios or superagent.
I personally find using the same API on the server and browser eases maintainability and offers potential for code reuse.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With