Skip to content

Commit 2a4a054

Browse files
committed
Adding Deploy to Cloudflare button.
1 parent 5d826fc commit 2a4a054

File tree

1 file changed

+16
-8
lines changed
  • src/content/docs/d1/tutorials/d1-and-prisma-orm

1 file changed

+16
-8
lines changed

src/content/docs/d1/tutorials/d1-and-prisma-orm/index.mdx

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,22 @@ To learn more about Prisma ORM, refer to the [Prisma documentation](https://www.
2323

2424
This tutorial shows you how to set up and deploy a Cloudflare Worker that is accessing a D1 database from scratch.
2525

26+
## Quick start
2627

28+
If you want to skip the steps and get started quickly, click on the button below.
2729

28-
### Prerequisites
30+
[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/d1-prisma/d1/query-d1-using-prisma)
31+
32+
This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. Use this option if you are familiar with Cloudflare Workers, and wish to skip the step-by-step guidance.
33+
34+
You may wish to manually follow the steps if you are new to Cloudflare Workers.
35+
36+
## Prerequisites
2937

3038
- [`Node.js`](https://nodejs.org/en/) and [`npm`](https://docs.npmjs.com/getting-started) installed on your machine.
3139
- A [Cloudflare account](https://dash.cloudflare.com).
3240

33-
### 1. Create a Cloudflare Worker
41+
## 1. Create a Cloudflare Worker
3442

3543
Open your terminal, and run the following command to create a Cloudflare Worker using Cloudflare's [`hello-world`](https://github.com/cloudflare/workers-sdk/tree/4fdd8987772d914cf50725e9fa8cb91a82a6870d/packages/create-cloudflare/templates/hello-world) template:
3644

@@ -43,7 +51,7 @@ In your terminal, you will be asked a series of questions related your project:
4351
1. Answer `yes` to using TypeScript.
4452
2. Answer `no` to deploying your Worker.
4553

46-
### 2. Initialize Prisma ORM
54+
## 2. Initialize Prisma ORM
4755

4856
:::note
4957

@@ -93,7 +101,7 @@ generator client {
93101
Do not specify an `output` destination in the `generator client` block. Instead, allow prisma to generate the files in the default output path.
94102
:::
95103

96-
### 3. Create your D1 database
104+
## 3. Create your D1 database
97105

98106
In this step, you will set up your D1 database. You can create a D1 database via the [Cloudflare dashboard](https://dash.cloudflare.com), or via `wrangler`. This tutorial will use the `wrangler` CLI.
99107

@@ -144,7 +152,7 @@ Replace `<D1_DATABASE_ID>` with the database ID of your D1 instance. If you were
144152

145153
Next, you will create a database table in the database to send queries to D1 using Prisma ORM.
146154

147-
### 4. Create a table in the database
155+
## 4. Create a table in the database
148156

149157
[Prisma Migrate](https://www.prisma.io/docs/orm/prisma-migrate/understanding-prisma-migrate/overview) does not support D1 yet, so you cannot follow the default migration workflows using `prisma migrate dev` or `prisma db push`.
150158

@@ -252,7 +260,7 @@ npx wrangler d1 execute prisma-demo-db --command "INSERT INTO `"User`" (`"email
252260
253261
:::
254262
255-
### 5. Query your database from the Worker
263+
## 5. Query your database from the Worker
256264
257265
To query your database from the Worker using Prisma ORM, you need to:
258266
@@ -279,7 +287,7 @@ Before running the Worker, generate Prisma Client with the following command:
279287
npx prisma generate
280288
```
281289
282-
### 6. Run the Worker locally
290+
## 6. Run the Worker locally
283291
284292
Now that you have the database query in place and Prisma Client generated, run the Worker locally:
285293
@@ -293,7 +301,7 @@ Open your browser at [`http://localhost:8787`](http://localhost:8787/) to check
293301
[{ "id": 1, "email": "[email protected]", "name": "Jane Doe (Local)" }]
294302
```
295303
296-
### 7. Deploy the Worker
304+
## 7. Deploy the Worker
297305
298306
To deploy the Worker, run the following command:
299307

0 commit comments

Comments
 (0)