@jmus/underrated-fetch 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# 🐶
|
|
1
|
+
# 🐶 Underrated-fetch
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|
[](https://www.npmjs.com/package/@jmus/underrated-fetch)
|
|
@@ -10,6 +10,33 @@ A simple **Node.js** wrapper around `fetch` that adds **TTL-based caching** for
|
|
|
10
10
|
|
|
11
11
|
Designed to reduce redundant outbound requests and avoid rate limits when calling external APIs.
|
|
12
12
|
|
|
13
|
+
### Example usage
|
|
14
|
+
|
|
15
|
+
```mermaid
|
|
16
|
+
flowchart LR
|
|
17
|
+
Mobile["Mobile App"] --> App["Node Service"]
|
|
18
|
+
App --> UF["🐶 Underrated fetch"]
|
|
19
|
+
|
|
20
|
+
%% Combined optional cache block
|
|
21
|
+
UF --> OptionalCache["Cache:<br>A) In Memory <br>B) Redis Shared Cache <br>C) Other Options"]
|
|
22
|
+
|
|
23
|
+
%% Cache hit/miss
|
|
24
|
+
OptionalCache -- cache hit --> UF
|
|
25
|
+
OptionalCache -- cache miss --> UF
|
|
26
|
+
|
|
27
|
+
%% Fetch network
|
|
28
|
+
UF --> Fetch["Fetch API"]
|
|
29
|
+
Fetch --> API["External API"]
|
|
30
|
+
API --> Fetch
|
|
31
|
+
|
|
32
|
+
%% Store results
|
|
33
|
+
UF -- store --> OptionalCache
|
|
34
|
+
|
|
35
|
+
%% App return
|
|
36
|
+
UF --> App
|
|
37
|
+
App --> Mobile
|
|
38
|
+
```
|
|
39
|
+
|
|
13
40
|
---
|
|
14
41
|
|
|
15
42
|
## Why?
|