The 'request' module has been a long-time standard for Node.js. They have recently deprecated the library.
I am starting a new project, and looking for the best solution to do my networking. I started off using the native 'https' module, but ran into problem after problem. Using the request
module seemed to be easy and work just fine. There are also many other libraries to replace the request
module.
Generally speaking, you should avoid using deprecated libraries when possible. But does that rule of thumb apply here?
Is it bad to start a new project with the 'request' module? If so, what is the new standard?
Request isn't really deprecated. It's no longer considering new features or breaking changes, but it is still being maintained. It's safe to use for the foreseeable future, but how good an idea it is to use it is up to the developer.
The request module is used to make HTTP calls. It is the simplest way of making HTTP calls in node. js using this request module. It follows redirects by default.
The main reason is that JavaScript evolved and changed at a much faster rate that anyone could expect, meaning that more HTTP calling packages have been developed on a more modern and secure code base. You can find a more detailed account on why 'request' is deprecating at an issue opened in its own GitHub repo.
The 'request' module has been a long-time standard for Node.js. They have recently deprecated the library. I am starting a new project, and looking for the best solution to do my networking. I started off using the native 'https' module, but ran into problem after problem. Using the request module seemed to be easy and work just fine.
After installing request module you can check your request version in command prompt using the command. After that, you can create a folder and add a file for example index.js, To run this file you need to run the following command. So this is how you can use the request module for making HTTP calls.
In case you want to use Pipenv, a Python packaging tool for installing the requests module, type in the following code: After installing the module, you can use it within your programs by importing it. Use the following code: Now, let us understand the most important methods of the python requests module – GET and POST.
How to create a project request form. 1 Decide on a consistent format. Much like when learning how to write a procedure, you first need to decide on a set format which your project request ... 2 Pick a project. 3 Cover the basic details. 4 Keep it simple. 5 Make deadlines and resources reasonable. More items
I would personally not start a new project with the request()
library unless it has a feature that no other library has that I absolutely need or unless I need another module that depends upon the request()
module itself.
When I have the freedom to choose, I'm using got()
for new projects instead. Choosing from the list of alternatives is a personal decision so you just have to evaluate the type of interface they each have and what features they have. For what I typically do with this type of library, got()
seemed simple and clean, built from the ground up with promises, meets my needs and I've had no problems using it.
Axios, node-fetch and superagent have advantages in that you can use a similar interface in both node.js and in the browser. All are popular and in wide use.
I tried bent, but didn't click with its programming interface.
I'd personally rather be using libraries that have a stated objective to continue to evolve with new developments in the language, new developments in nodejs libraries and add new features over time rather than a library that says it will not be adding new features.
I also like using a library that has promise support built-in from the core rather than added on only as a wrapper since I do all asynchronous programming with promises now.
Some other resources in examining the alternatives:
Feature comparison chart (written by the makers of got()
)
Migrating to got() from request
And, if you want to read about why the request()
library has gone into maintenance mode, read here.
In a nutshell, it's an old architecture with tons of features glued onto the side, but because there are so many modules dependent upon it, they can't really break their API to fix or smooth things out. And, because it's so popular, it is holding back the success of competing solutions that have designed a cleaner interface. So, the decision was made to let the alternatives that have been designed in a more modern way take the mantle going forward and request()
will go into maintenance mode to continue to support the other modules that are dependent upon it, but not try to evolve into a more modern interface.
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