Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

replacement for npm package request

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!

like image 953
ArcticMediaRyan Avatar asked Jul 31 '26 08:07

ArcticMediaRyan


2 Answers

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

like image 142
ArcticMediaRyan Avatar answered Aug 01 '26 23:08

ArcticMediaRyan


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.

Key Features

  • Supports callbacks, promises (async/await), and .pipe() streaming.

  • Handles common options like json, form, qs, auth, and jar.

NPM Link

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.

like image 37
Manny Avatar answered Aug 01 '26 21:08

Manny