A trick to improve speed when you are interfacing with a slow API

TLDR; 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. You can visit the repo of this package here. Below, I explain my motivation, and how I tackled the issue. So here’s the scenario: You have a system that interfaces with a really slow third-party API. User Bob, needs some data, so your system performs a request to the third-party API, and waits for a response....

January 19, 2020 · 5 min · 976 words · Christos Panagiotakopoulos