You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/guides/6.best-practices/2.data-fetching.md
+7-4Lines changed: 7 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,8 @@ The rule of thumb is: _always use server-side fetching except for_:
42
42
43
43
Alokai architecture introduces the Middleware in between the front-end application and the APIs. This adds two additional possible routes to our diagram, but most of the traffic should go through the middleware, because:
44
44
45
-
- it is cached on the CDN
45
+
<!-- Uncomment below when CDN caching is availavble -->
46
+
<!-- - it is cached on the CDN -->
46
47
- it keeps your architecture simple
47
48
- you can easily monitor middleware traffic in the console
@@ -58,22 +59,24 @@ Fortunately, we can reject the route between the server and the API, because:
58
59
The direct route between the browser and API should be avoided, because it:
59
60
60
61
- tightly couples storefront with the API,
61
-
- reduces performance by bypasses CDN cache.
62
+
<!-- Uncomment below when CDN caching is availavble -->
63
+
<!-- - reduces performance by bypassing CDN cache. -->
62
64
63
65
Use direct direct browser to API calls only when communicating via middleware is not possible or requires unnecessary effort. Sample scenarios when it might be valid to communicate directly between client and API:
64
66
65
67
- the communication requires extremely low latency - e.g. voice or video stream
66
68
- communication with API is done via some SDK that requires direct client (browser) interaction - e.g. analytics or authentication services
67
69
68
-
## CDN Caching
70
+
<!-- Uncomment below when CDN caching is availavble -->
71
+
<!-- ## CDN Caching
69
72
70
73
To further improve your application performance we encourage you to enable the CDN. The CDN is capable of caching responses from the server and the middleware to the browser.
71
74
72
75
<img src="/images/data-fetching-cdn.svg" alt="data fetching and CDN" class="mx-auto">
73
76
74
77
::info
75
78
[Read more about caching here.](/storefront/features/cdn/making-ssr-cacheable)
0 commit comments