I'm looking for a definitive way to handle simple HTTP requests to a REST API using modern javascript frameworks, in my case Typescript but I guess it would also apply to Nodejs.
Since there doesn't seem to be a simple native way to do this, I have found a plethora of libraries, some now deprecated and dozen's of articles dating back several years some with updates based on the newer best practises. Surely it can't be that hard. This takes me about 5mins to implement in Golang or Python, but alas with JavaScript its a pain - Is it just me?
Could somebody please clarify the current state of play and recommended way to do this based on where we are now in 2020.
fetch(). In node.js, you can use the built-inhttp.request()or there are higher level and more feature-rich libraries such asgot()orsuperAgent()oraxios(). A good list of options is here. I'm usinggot().http.request()requestandrequest-promisewere kind of the defacto standard for a long time and many nodejs tutorials show them and teach them and for years if you followed a lot of node.js code, you would seem them used a lot. As it sounds like you know, they have been deprecated in the last year for a variety of reasons so that recently opened up the playing field to all the other options. I imagine one or two "winners" will emerge and again become the favorites that many people encounter first, though there are many good options.