A trick to improve speed when you are interfacing with a slow API.
I created a small npm package that acts as a wrapper around node-fetch, and returns the same promise for the same request, until it resolves.
https://chrispanag.com/posts/improve-speed-interfacing-with-slow-api/
Sometimes, you have to interface with an API that doesn't respond fast enough. Moreover, you might perform the same request multiple times.
The solution?
Return the same promise for the same exact requests until they resolve. This is more useful when you interface with stateless APIs, where you just consume data.
https://github.com/chrispanag/memoized-node-fetch
#node #nodejs #npm #npmpackage #package #javascript #typescript #opensource
My name is Christos, I'm a Software Engineer from Athens, Greece.
I'm mostly working with #nodejs and #typescript, but I'm also interested in #ruby, #linux and systems engineering.
I maintain a few (still not very popular 😅) open-source JS/TS libraries I created for my applications, so check my github profile if you want to see more on what I'm working on: https://github.com/chrispanag
Software Engineer (he/him)
Living in Athens, Greece 🇪🇺🇬🇷
I'm mostly working with #nodejs, #javascript & #typescript but I'm also interested in #go, #linux, #ipfs and systems engineering.
I'm an open-source enthusiast and an advocate for #opendata and #opengovernance.
Building decentralised discourse at Capsule Social (https://capsule.social)