Skip to content

Commit d396ba6

Browse files
jason-cfmaheshwarip
authored andcommitted
Adding two video tutorials to d1 and pages (#17249)
1 parent da6af77 commit d396ba6

File tree

2 files changed

+24
-6
lines changed
  • src/content/docs
    • d1/tutorials/build-a-comments-api
    • pages/tutorials/build-an-api-with-pages-functions

2 files changed

+24
-6
lines changed

src/content/docs/d1/tutorials/build-a-comments-api/index.mdx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
updated: 2022-11-23
2+
updated: 2024-10-01
33
difficulty: Intermediate
44
content_type: 📝 Tutorial
55
pcx_content_type: tutorial
@@ -13,7 +13,7 @@ languages:
1313
- SQL
1414
---
1515

16-
import { Render, PackageManagers } from "~/components";
16+
import { Render, PackageManagers, Stream } from "~/components";
1717

1818
In this tutorial, you will learn how to use D1 to add comments to a static blog site. To do this, you will construct a new D1 database, and build a JSON API that allows the creation and retrieval of comments.
1919

@@ -39,6 +39,14 @@ To start developing your Worker, `cd` into your new project directory:
3939
cd d1-example
4040
```
4141

42+
## Video Tutorial
43+
44+
<Stream
45+
videoId="8d20dd6cf5679f3272ca44a9fa01728c"
46+
videoTitle="Build a Comments API with D1"
47+
thumbnailStartTime="22s"
48+
/>
49+
4250
## 1. Install Hono
4351

4452
In this tutorial, you will use [Hono](https://github.com/honojs/hono), an Express.js-style framework, to build your API. To use Hono in this project, install it using `npm`:

src/content/docs/pages/tutorials/build-an-api-with-pages-functions/index.mdx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
updated: 2023-05-31
2+
updated: 2024-10-01
33
pcx_content_type: tutorial
44
content_type: 📝 Tutorial
55
difficulty: Intermediate
@@ -8,14 +8,24 @@ languages:
88
- JavaScript
99
---
1010

11+
import { Stream } from "~/components";
12+
1113
In this tutorial, you will build a full-stack Pages application. Your application will contain:
1214

1315
- A front end, built using Cloudflare Pages and the [React framework](/pages/framework-guides/deploy-a-react-site/).
1416
- A JSON API, built with [Pages Functions](/pages/functions/get-started/), that returns blog posts that can be retrieved and rendered in your front end.
1517

1618
If you prefer to work with a headless CMS rather than an API to render your blog content, refer to the [headless CMS tutorial](/pages/tutorials/build-a-blog-using-nuxt-and-sanity/).
1719

18-
## Build your front end
20+
## Video Tutorial
21+
22+
<Stream
23+
videoId="2d8bbaa18fbd3ffa859a7fb30e9b3dd1"
24+
videoTitle="Build an API With Pages Functions"
25+
thumbnailStartTime="29s"
26+
/>
27+
28+
## 1. Build your front end
1929

2030
To begin, create a new Pages application using the React framework.
2131

@@ -144,7 +154,7 @@ const Post = () => {
144154
export default Post;
145155
```
146156

147-
## Build your API
157+
## 2. Build your API
148158

149159
You will now create a Pages Functions that stores your blog content and retrieves it via a JSON API.
150160

@@ -215,7 +225,7 @@ export function onRequestGet(context) {
215225

216226
`[[id]].js` is a [dynamic route](/pages/functions/routing#dynamic-routes) which is used to accept a blog post `id`.
217227

218-
## Deploy
228+
## 3. Deploy
219229

220230
After you have configured your Pages application and Pages Function, deploy your project using the Wrangler or via the dashboard.
221231

0 commit comments

Comments
 (0)