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
* docs: add best practices collection and data fetching guide
* docs: add data fetching examples
* docs: explain why not to fetch lazy loaded data server side
* docs: comment out info about CDN
Copy file name to clipboardExpand all lines: docs/content/guides/6.best-practices/2.data-fetching.md
+8-3
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,13 +59,17 @@ 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
70
+
71
+
<!-- Uncomment below when CDN caching is availavble -->
72
+
<!-- ## CDN Caching
68
73
## CDN Caching
69
74
70
75
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.
@@ -73,7 +78,7 @@ To further improve your application performance we encourage you to enable the C
73
78
74
79
::info
75
80
[Read more about caching here.](/storefront/features/cdn/making-ssr-cacheable)
0 commit comments