DEV Community

Cover image for Request for Node.js has been deprecated
Corentin for Mailmeteor

Posted on • Edited on

Request for Node.js has been deprecated

The breaking news landed a few days ago, with a simple commit entitled "doc: note full deprecation".

That's right! request, one of the top and oldest npm packages, has been deprecated by @mikeal its creator.

Screenshot of the deprecation notice on npm

As of writing, over 40K packages rely on request. In fact, it's the 4th most depended upon package on npm. And it has a whopping 18.5 million weekly downloads.

For the most familiar with the package's development, there's no news here. request was in maintenance mode since March 2019 (see issue #3142). And deprecating the package is just one step further.

Still, it is, I believe, a truly courageous and clever step toward the future of the Node.js (and more broadly the JavaScript) ecosystem.

Let's review what led to this situation.

Without paraphrasing too much @mikeal statement back from March 2019, here are the key points that led to this deprecation:

  • Back in 2009, request was one of the first modules ever created for the Node.js ecosystem.
  • For a few years, request and Node.js evolved together, each learning from the other.
  • And as one of the very first modules listed on npm, request quickly became one of the most downloaded.

But:

"The place request has in the Node.js ecosystem is no longer one of an innovator but of an incumbent." @mikeal

That's right that most tutorials, even here on DEV, use request as the per-default HTTP client - while there are dozens of very good alternatives.

"The best thing for these new modules is for request to slowly fade away, eventually becoming just another memory of that legacy stack." @mikeal

That's the very first time that I see such a humble position. It's truly clever. And while it's going to require 40K+ packages to be upgraded, that's totally worth it.

What do you think?

Top comments (8)

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt

Why not standard library anyways?

I really hate to see this error message in node-sqlite3. Why does need request, anyway?

Collapse
 
maple3142 profile image
maple

You can use that if you want, but it is a little bit verbose to write compared to other libraries, which most developers don't like.

Collapse
 
frenchcooc profile image
Corentin

I kind of prefer the core HTTP module as well. It helps to really understand how it works in depth. But it's also pretty verbose compared to most frameworks/lib.

Collapse
 
aerabi profile image
Mohammad-Ali A'RÂBI

As I have mentioned in this StackOverflow answer, the reason for deprecation is both the interface and the underlying code.

Callbacks are very hard to deal with. This is why we have promisify and bindCallback for promises and observables, respectively. But, as request is a many-faced god, it's hard to get rid of its callback interface.

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

I prefer a node fetch implementation in case I had a view for isomorphism, there is one less thing to change.

Collapse
 
tracker1 profile image
Michael J. Ryan

For pretty much everything I'm working on now, I cut off with fetch and async function support (around April 2017 and newer browsers). In node, I use node-fetch or setup a global if I'm sharing code libraries.

While fetch isn't perfect, usually create an api wrapper around it. It's standard, cleaner than alternatives and built into the browsers (smaller bundles).

Collapse
 
frenchcooc profile image
Corentin

That's exactly why @mikeal the creator of request deprecated the project

Collapse
 
frenchcooc profile image
Corentin

Yeah! fetch is easy to use and pretty well supported now.