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: src/content/docs/d1/tutorials/using-read-replication-for-e-com/index.mdx
+17-3Lines changed: 17 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,20 @@ import {
24
24
25
25
While this tutorial uses a fictional e-commerce website, the principles can be applied to any use-case that requires high availability and low read latencies, such as a news website, a social media platform, or a marketing website.
26
26
27
+
## Quick start
28
+
29
+
If you want to skip the steps and get started quickly, click on the below button:
30
+
31
+
[](https://deploy.workers.cloudflare.com/?url=https://github.com/harshil1712/e-com-d1-hono)
32
+
33
+
This will create a repository in your GitHub account and deploy the application to Cloudflare Workers. It will also create and bind a D1 database, create the required tables, and add some sample data. You can visit the deployed application. However, you need to enable D1 Read Replication for your database.
34
+
35
+
To enable D1 Read Replication for your database, run the following command:
Since you are writing the data to the database, you use the `first-primary` constraint.
646
+
Since you are writing the data to the database, you use the `first-primary` constraint. Even if you use the `first-unconstrained` constraint or pass a bookmark, the write request will always be routed to the primary database.
633
647
634
-
The bookmark set in the cookie is used to get the latest data from the database.
648
+
The bookmark set in the cookie can be used to get the data from the database for a new session from that instance.
635
649
636
650
If you are using an external platform to manage your products, you can connect this API to the external platform, such that, when a product is created or updated in the external platform, the D1 database automatically updates the product details.
0 commit comments