Skip to content

Commit 803591d

Browse files
committed
docs: fix typos in article
1 parent 8af0745 commit 803591d

File tree

1 file changed

+22
-20
lines changed

1 file changed

+22
-20
lines changed

docs/content/5.blog/2.drawing-app-with-nuxt-and-cloudflare-r2.md

+22-20
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ category: Tutorial
1616

1717
## Introduction
1818

19-
I won't go into each details of the code, but I'll try to explain the main concepts and how to build a drawing app with Nuxt and Cloudflare R2.
19+
I won't go into each detail of the code, but I'll try to explain the main concepts and how to build a drawing app with Nuxt and Cloudflare R2.
2020

21-
Atidraw is a web application that lets you to create and share your drawings with the world. Harnessing the power of OAuth for user authentication and Cloudflare R2 to store and list the drawings.
21+
Atidraw is a web application that lets you create and share your drawings with the world. Our app uses OAuth for user authentication and Cloudflare R2 to store and list drawings.
2222

23-
The application is running with server-side rendering on the edge using Cloudflare Pages on the Workers free plan.
23+
The application runs with server-side rendering on the edge using Cloudflare Pages on the Workers free plan.
2424

2525
::video{poster="https://res.cloudinary.com/nuxt/video/upload/v1723210615/nuxthub/344159247-85f79def-f633-40b7-97c2-3a8579e65af1_xyrfin.jpg" controls class="lg:w-2/3 h-auto border dark:border-gray-800 rounded"}
2626
:source{src="https://res.cloudinary.com/nuxt/video/upload/v1723210615/nuxthub/344159247-85f79def-f633-40b7-97c2-3a8579e65af1_xyrfin.webm" type="video/webm"}
@@ -29,15 +29,15 @@ The application is running with server-side rendering on the edge using Cloudfla
2929
::
3030

3131
::note{to="https://draw.nuxt.dev" icon="i-ph-rocket-launch-duotone" color="blue" target="_blank"}
32-
The demo is available on **draw.nuxt.dev**.
32+
The demo is available at **draw.nuxt.dev**.
3333
::
3434
::callout{to="https://github.com/atinux/atidraw" icon="i-simple-icons-github" color="gray" target="_blank"}
35-
The source code of the app is available on **github.com/atinux/atidraw**.
35+
The source code of the app is available at **github.com/atinux/atidraw**.
3636
::
3737

3838
## Project Dependencies
3939

40-
Our Nuxt application is using the following dependencies:
40+
Our Nuxt application uses the following dependencies:
4141

4242
- [`nuxt-auth-utils`](https://github.com/atinux/nuxt-auth-utils) for user authentication
4343
- [`signature_pad`](https://github.com/szimek/signature_pad) for the drawing canvas
@@ -61,16 +61,16 @@ export default defineNuxtConfig({
6161
```
6262

6363
::note
64-
The `blob` option will use Cloudflare platform proxy in development and automatically create a Cloudflare R2 bucket for your project when you deploy it. It also provide helpers to upload and list files.
64+
The `blob` option will use Cloudflare platform proxy in development and automatically create a Cloudflare R2 bucket for your project when you deploy it. It also provides helpers to upload and list files.
6565
::
6666

6767
::tip
68-
The project is also using the `future.compatibilityVersion: 4` option to use the [new directory structure](https://nuxt.com/docs/getting-started/upgrade#new-directory-structure).
68+
The project is also using the `future.compatibilityVersion: 4` option to leverage the [new directory structure](https://nuxt.com/docs/getting-started/upgrade#new-directory-structure).
6969
::
7070

7171
## User Authentication
7272

73-
For user authentication, we'll use [`nuxt-auth-utils`](https://github.com/atinux/nuxt-auth-utils), it providers helpers to authenticate users with OAuth providers and storing the user session in encrypted cookies.
73+
For user authentication, we'll use [`nuxt-auth-utils`](https://github.com/atinux/nuxt-auth-utils). It provides functions to authenticate users with OAuth providers and stores the user session in encrypted cookies.
7474

7575
First, we need to set up a session secret (used to encrypt & decrypt the session cookie) and our OAuth application credentials in the `.env` file:
7676

@@ -101,14 +101,14 @@ export default oauthGitHubEventHandler({
101101
```
102102

103103
::tip
104-
The `.get.ts` suffix is indicating that only GET requests will be handled by this route.
104+
The `.get.ts` suffix indicates that only GET requests will be handled by this route.
105105
::
106106

107107
When the user hits `/auth/github`:
108108
1. `oauthGitHubEventHandler` redirects the user to the GitHub OAuth page
109-
2. The user is redirected back to **/auth/github**
109+
2. The user is then redirected back to **/auth/github**
110110
3. `onSuccess()` is called and the user session is set in a cookie
111-
4. The user is redirected to **/draw**
111+
4. The user is finally redirected to **/draw**
112112

113113
In [`app/pages/draw.vue`](https://github.com/atinux/atidraw/blob/main/app/pages/draw.vue), we can leverage [`useUserSession()`](https://github.com/atinux/nuxt-auth-utils?tab=readme-ov-file#vue-composable) to know if the user is authenticated or not.
114114

@@ -251,18 +251,18 @@ export default eventHandler(async (event) => {
251251
```
252252

253253
::tip
254-
The `requireUserSession()` helper is provided by [`nuxt-auth-utils`](https://github.com/atinux/nuxt-auth-utils) and will throw a `401` error if the user is not authenticated.
254+
The `requireUserSession()` function is provided by [`nuxt-auth-utils`](https://github.com/atinux/nuxt-auth-utils) and will throw a `401` error if the user is not authenticated.
255255
::
256256

257-
As you can see, we don't need to have a database as we store the user metadata in the Cloudflare R2 bucket custom metadata.
257+
As you can see, we don't need a database as we store the user metadata in the Cloudflare R2 bucket custom metadata.
258258

259259
::note
260-
Learn more about the [`hubBlob()`](/docs/storage/blob) server helper to work with the Cloudflare R2 bucket.
260+
Learn more about the [`hubBlob()`](/docs/storage/blob) server function to work with the Cloudflare R2 bucket.
261261
::
262262

263263
## List Drawings
264264

265-
It's time to list our users drawings, first, we need to create a new API route in `server/api/drawings.get.ts`:
265+
It's time to list our user drawings! First, however, we need to create a new API route in `server/api/drawings.get.ts`:
266266

267267
```ts [server/api/drawings.get.ts]
268268
export default eventHandler(async (event) => {
@@ -293,15 +293,17 @@ const { data } = await useFetch('/api/drawings')
293293
</template>
294294
```
295295

296+
::tip{icon="i-ph-rocket-launch"}
296297
That's it! We have a minimal and fully functional drawing application.
298+
::
297299

298300
## Drawings Order
299301

300302
You may have noticed that the last drawing is displayed last, this is because Cloudflare R2 is using alphabetical order to list the files and we use the timestamp (using `Date.now()`) as the file name. Also, R2 doesn't support listing files with a custom order.
301303

302304
Even though it's easy to add a Cloudflare D1 database with [`hubDatabase()`](/docs/storage/database), I wanted to keep this example as simple as possible.
303305

304-
Instead, I had the idea to use the timestamp in 2050 minus the timestamp of the drawing to get a descending order. Yeah, it's a bit hacky but it works, until 2050, it's still a long time 😄.
306+
Instead, I had the idea to use the timestamp in 2050 minus the timestamp of the drawing to get a descending order. It's not perfect but it works, until 2050, it's still a long time 😄.
305307

306308
Let's update our **/api/upload** route to update the filename:
307309

@@ -465,13 +467,13 @@ Or go to https://admin.hub.nuxt.com and select your project.
465467

466468
Congratulations! You've now built a fully functional drawing application using Nuxt and Cloudflare R2 for storage. Users can create drawings, save them to the cloud, and access them from anywhere.
467469

468-
Next, we are going to leverage Cloudflare AI to generate the alt text for the user drawings (accessibility & SEO) as well as generating an alternative drawing using AI.
470+
Next, we are going to leverage Cloudflare AI to generate the alternative text for the user drawings (accessibility & SEO) as well as generating an alternative drawing using AI.
469471

470472
Feel free to expand on this foundation and add your own unique features to make Atidraw yours!
471473

472474
::callout{to="https://github.com/atinux/atidraw" icon="i-simple-icons-github" color="gray" target="_blank"}
473-
The source code of the app is available on **github.com/atinux/atidraw**.
475+
The source code of the app is available at **github.com/atinux/atidraw**.
474476
::
475477
::note{to="https://draw.nuxt.dev" icon="i-ph-rocket-launch-duotone" target="_blank"}
476-
The demo is available on **draw.nuxt.dev**.
478+
The demo is available at **draw.nuxt.dev**.
477479
::

0 commit comments

Comments
 (0)