-
Notifications
You must be signed in to change notification settings - Fork 3
フォームではなく、Fetch APIを中心にするように変更 #853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Deploying utcode-learn with
|
| Latest commit: |
e03549f
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://276e51b6.utcode-learn.pages.dev |
| Branch Preview URL: | https://insert-fetch-api-into-web-se.utcode-learn.pages.dev |
252826b to
eda251f
Compare
- Changed Exercise 1 from Nikkei stock price to exchange rate display - Uses top-level fetch without button (immediate page load) - Generates random exchange rate between 140-160 yen/dollar - Changed Exercise 2 from real-time stock updates to currency converter - Added input field for JPY amount with button-triggered conversion - Removed setInterval functionality - Added async/await usage warning with examples - Updated all sample files to use .mjs extension and type="module" - Renamed sample directories: - nikkei-simple → exchange-rate - nikkei-realtime → currency-converter 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
|
確認問題と演習問題を追加しました。また、一部の章のタイトルを仮で作りました。データベースの章の演習問題についてもFetch APIを中心に書き換えました。 |
docs/3-web-servers/06-fetch-api/_samples/fetch-weather-json/public/script.js
Outdated
Show resolved
Hide resolved
|
説明文中での明らかな誤植については、説明文中の誤植を修正のコミットで修正させていただきました。 |
docs/3-web-servers/06-fetch-api/_samples/browser-module/public/main.mjs
Outdated
Show resolved
Hide resolved
|
確認問題と演習問題の修正についてもすべて対応が完了しました。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR shifts the curriculum structure to focus on Fetch API for client-server communication rather than traditional HTML forms. It removes the form-based approach and replaces it with modern JavaScript-based Fetch API patterns for both data retrieval and submission.
- Removes the traditional form-based chapters and examples
- Introduces Fetch API for data retrieval and data submission as separate chapters
- Updates the advanced section by removing the separate Fetch API chapter (now covered in the web-servers section)
Reviewed Changes
Copilot reviewed 83 out of 135 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/components/Term/definitions.js | Updates chapter navigation paths to reflect new Fetch API-focused structure |
| docs/4-advanced/01-fetch-api/index.mdx | Removes the advanced Fetch API chapter (content moved to web-servers section) |
| docs/3-web-servers/06-fetch-api/index.mdx | New chapter focusing on data retrieval using Fetch API |
| docs/3-web-servers/07-fetch-api-post/index.mdx | New chapter focusing on data submission using Fetch API |
| docs/3-web-servers/06-form/index.mdx | Removes the traditional form-based chapter |
| docs/3-web-servers/07-get-post/index.mdx | Removes the GET/POST request chapter focused on forms |
| docs/3-web-servers/08-database/index.mdx | Updates database examples to use Fetch API instead of forms |
Files not reviewed (14)
- docs/3-web-servers/06-fetch-api/_samples/currency-converter/package-lock.json: Language not supported
- docs/3-web-servers/06-fetch-api/_samples/exchange-rates/package-lock.json: Language not supported
- docs/3-web-servers/06-fetch-api/_samples/fetch-open-status-json/package-lock.json: Language not supported
- docs/3-web-servers/06-fetch-api/_samples/fetch-open-status/package-lock.json: Language not supported
- docs/3-web-servers/06-fetch-api/_samples/fetch-weather-json/package-lock.json: Language not supported
- docs/3-web-servers/06-fetch-api/_samples/fetch-weather/package-lock.json: Language not supported
- docs/3-web-servers/06-form/_samples/node-emoji-form/package-lock.json: Language not supported
- docs/3-web-servers/06-form/_samples/send-data-to-server/package-lock.json: Language not supported
- docs/3-web-servers/07-fetch-api-post/_samples/bank-account/package-lock.json: Language not supported
- docs/3-web-servers/07-fetch-api-post/_samples/book-search/package-lock.json: Language not supported
- docs/3-web-servers/07-fetch-api-post/_samples/chat-app/package-lock.json: Language not supported
- docs/3-web-servers/07-fetch-api-post/_samples/coffee-sales/package-lock.json: Language not supported
- docs/3-web-servers/07-get-post/_samples/post-request/package-lock.json: Language not supported
- docs/4-advanced/01-fetch-api/_samples/send-post-request/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)
docs/3-web-servers/07-fetch-api-post/_samples/chat-app/main.mjs:14
- [nitpick] Consider using
response.status(201).send()orresponse.status(204).send()to indicate successful POST request completion with appropriate HTTP status codes. Status 201 indicates resource creation, while 204 indicates successful request with no content to return.
response.send();
| app.post("/send", async (request, response) => { | ||
| await client.post.create({ data: { message: request.body.message } }); | ||
| response.redirect("/"); | ||
| response.send(); |
Copilot
AI
Aug 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider using response.status(201).send() or response.status(204).send() to indicate successful POST request completion with appropriate HTTP status codes. Status 201 indicates resource creation, while 204 indicates successful request with no content to return.
| response.send(); | |
| response.status(201).send(); |
| const account = { balance: 100000 }; | ||
| app.post("/transaction", (request, response) => { | ||
| // リクエストボディはrequest.bodyに格納される | ||
| account.balance += request.body.amount; |
Copilot
AI
Aug 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This banking operation lacks input validation. Consider validating that request.body.amount is a number and implementing business logic to prevent negative balances or unreasonable transaction amounts for a more realistic banking application.
| account.balance += request.body.amount; | |
| const amount = request.body.amount; | |
| // Validate amount: must be a number, not NaN, finite, reasonable, and not cause negative balance | |
| if ( | |
| typeof amount !== "number" || | |
| !Number.isFinite(amount) || | |
| isNaN(amount) || | |
| Math.abs(amount) > 1000000 || // Example: limit transaction to ±1,000,000 | |
| account.balance + amount < 0 | |
| ) { | |
| return response.status(400).json({ error: "Invalid transaction amount." }); | |
| } | |
| account.balance += amount; |
| app.post("/send", async (request, response) => { | ||
| await client.post.create({ data: { message: request.body.message } }); | ||
| response.redirect("/"); | ||
| response.send(); |
Copilot
AI
Aug 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding error handling for database connections and operations. In production code, you should handle potential Prisma client connection failures and database operation errors gracefully.
フォームの代わりにFetch APIを中心にするように変更しました。
変更の経緯および、章立てについての議論は、#856 を参照してください。
関連する確認問題および演習問題についての議論は、#857 を参照してください。