Conversation
Deploying utcode-learn with
|
| Latest commit: |
15e1d16
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://33f779b4.utcode-learn.pages.dev |
| Branch Preview URL: | https://rewrite-cookie.utcode-learn.pages.dev |
There was a problem hiding this comment.
Pull Request Overview
This PR rewrites the Cookie section of the documentation to improve its structure and provide a more comprehensive guide to authentication in web applications. The changes focus on reorganizing content to better explain cookies in the context of authentication systems.
Key changes include:
- Complete restructuring of the Cookie documentation with new authentication-focused content
- Addition of new term definitions for HTTP status codes and method terminology updates
- Addition of comprehensive sample applications demonstrating cookie-based authentication
Reviewed Changes
Copilot reviewed 16 out of 29 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/components/Term/type-map.js | Adds mapping for HTTP status code term |
| src/components/Term/definitions.js | Updates HTTP method name and adds status code definition |
| docs/4-advanced/01-cookie/index.mdx | Complete rewrite focusing on authentication with cookies |
| docs/4-advanced/01-cookie/_samples/ | New sample applications for cookie counter and authentication |
| docs/3-web-servers/07-fetch-api-post/index.mdx | Updates status code reference to use new term |
| .vscode/settings.json | Adds Prisma formatter configuration |
Files not reviewed (2)
- docs/4-advanced/01-cookie/_samples/cookie-counter/package-lock.json: Language not supported
- docs/4-advanced/01-cookie/_samples/simple-authentication/package-lock.json: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
docs/4-advanced/01-cookie/_samples/simple-authentication/main.mjs
Outdated
Show resolved
Hide resolved
docs/4-advanced/01-cookie/index.mdx
Outdated
| app.get("/", (request, response) => { | ||
| // Cookieの値は文字列なので数値に変換が必要 | ||
| const count = parseInt(request.cookies.count) || 0; | ||
| const count = Number.parseInt(request.cookies.count) || 0; |
There was a problem hiding this comment.
変更前からそうなっているので申し訳ないのですが、このような論理和演算子や論理積演算子の使い方は、「React」の節ではじめて扱うので、この時点では未履修となっています。
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 17 out of 30 changed files in this pull request and generated 1 comment.
Files not reviewed (2)
- docs/4-advanced/01-cookie/_samples/cookie-counter/package-lock.json: Language not supported
- docs/4-advanced/01-cookie/_samples/simple-authentication/package-lock.json: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
docs/4-advanced/01-cookie/index.mdx
Outdated
|
|
||
| `/login`は、IDとパスワードを含むJSON形式のPOSTリクエストを受け取り、データベースの`User`テーブルのデータと比較することで、認証情報が正しいかどうかを検証します。正しければ、[`crypto.randomUUID`関数](https://developer.mozilla.org/ja/docs/Web/API/Crypto/randomUUID)を用いてランダムな文字列を生成し、新しいレコードを`Session`テーブルに作成した上で、Cookieとしてクライアントに送信します。誤っていれば、直ちに認証失敗の<Term>ステータスコード</Term>を返して終了します。 | ||
|
|
||
| 新しいレコードを`Session`テーブルに作成し、その`sessionId`をCookieとしてクライアントに送信します。誤っていれば、直ちに認証失敗の<Term>ステータスコード</Term>を返して終了します。 |
There was a problem hiding this comment.
This sentence appears to be duplicated content from the previous paragraph (line 114). The first part repeats information already explained, making the documentation redundant.
| 新しいレコードを`Session`テーブルに作成し、その`sessionId`をCookieとしてクライアントに送信します。誤っていれば、直ちに認証失敗の<Term>ステータスコード</Term>を返して終了します。 |
chvmvd
left a comment
There was a problem hiding this comment.
ありがとうございます。
後は、ここだけだと思います。
docs/4-advanced/01-cookie/index.mdx
Outdated
| `/login`は、IDとパスワードを含むJSON形式のPOSTリクエストを受け取り、データベースの`User`テーブルのデータと比較することで、認証情報が正しいかどうかを検証します。正しければ、[`crypto.randomUUID`関数](https://developer.mozilla.org/ja/docs/Web/API/Crypto/randomUUID)を用いてランダムな文字列を生成し、新しいレコードを`Session`テーブルに作成した上で、Cookieとしてクライアントに送信します。誤っていれば、直ちに認証失敗の<Term>ステータスコード</Term>を返して終了します。 | ||
|
|
||
| 新しいレコードを`Session`テーブルに作成し、その`sessionId`をCookieとしてクライアントに送信します。誤っていれば、直ちに認証失敗の<Term>ステータスコード</Term>を返して終了します。 |
docs/4-advanced/01-cookie/index.mdx
Outdated
| } | ||
| ``` | ||
|
|
||
| `/login`は、IDとパスワードを含むJSON形式のPOSTリクエストを受け取り、データベースの`User`テーブルのデータと比較することで、認証情報が正しいかどうかを検証します。正しければ、[`crypto.randomUUID`関数](https://developer.mozilla.org/ja/docs/Web/API/Crypto/randomUUID)を用いてランダムな文字列を生成し、新しいレコードを`Session`テーブルに作成した上で、Cookieとしてクライアントに送信します。誤っていれば、直ちに認証失敗の<Term>ステータスコード</Term>を返して終了します。 |
There was a problem hiding this comment.
ここでの「ランダムな文字列」とPrisma Schemaに書かれている「一意でランダムなID」が同じものを指しているということが少しわかりにくいのかなと思いました。
つまり、crypto.randomUUID関数で生成されたランダムな文字列が、「一意」であるということが初学者には非自明ではないかと思いました。
「crypto.randomUUID関数を用いて一意でランダムなIDを生成し」などでもよいのかなと。
No description provided.