So, I am trying to upgrade a repo from a 3rd party project that is no longer maintained. The issue is it uses "request". Here is a sample of the code
To be clear... The package is called "REQUEST"
request.post(
{
url: config.URL,
form: {
a: "checkToken",
webmasterid: sited,
token: token,
},
},
As I am not a expressJS/Socket.io guy, I am not sure what the new format would be and what I would do to fix this. There are 48 different instances of request.post so I can only guess there is a solution.
Any help would be great!
I FINALLY found an article that gave me the ability to choose based on what is needed. As I am only doing a simple post I could have done this a number of ways but I settled on GOT just so I know I am working on the right solution with something that is full featured.
https://nodesource.com/blog/express-going-into-maintenance-mode
I hope this helps someone else
Acknowledging that this question ranks highly for "npm request replacement".. I'm posting a solution for others who are looking for a direct, drop-in replacement rather than refactoring.
A modern library designed for this is dropin-request. It mimics the original request API with the goal of minimizing or eliminating the need for refactoring in legacy codebases.
Supports callbacks, promises (async/await), and .pipe() streaming.
Handles common options like json, form, qs, auth, and jar.
https://www.npmjs.com/package/dropin-request
Full disclosure: I am the author of this library. It is designed to cover the most common use cases, and community contributions to expand its feature set are welcome.
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