Skip to content

Commit 77e4f61

Browse files
committed
translate 02-sveltekit/05-api-routes/01-get-handlers into Japanese
1 parent 1f974da commit 77e4f61

File tree

1 file changed

+4
-4
lines changed
  • content/tutorial/02-sveltekit/05-api-routes/01-get-handlers

1 file changed

+4
-4
lines changed

content/tutorial/02-sveltekit/05-api-routes/01-get-handlers/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
title: GET handlers
33
---
44

5-
SvelteKit allows you to create more than just pages. We can also create _API routes_ by adding a `+server.js` file that exports functions corresponding to HTTP methods: `GET`, `PUT`, `POST`, `PATCH` and `DELETE`.
5+
SvelteKit では、ページ以外にも様々なものを作ることができます。`+server.js` ファイルを追加し、そこでHTTP メソッド `GET``PUT``POST``PATCH``DELETE` に対応する関数をエクスポートすることで、 _API ルート(API routes)_ を作成することもできます。
66

7-
This app fetches data from a `/roll` API route when you click the button. Create that route by adding a `src/routes/roll/+server.js` file:
7+
このアプリは、ボタンwをクリックしたときに `/roll` API ルートからデータを取得します。`src/routes/roll/+server.js` ファイルを追加し、そのルートを作成しましょう。
88

99
```js
1010
/// file: src/routes/roll/+server.js
@@ -19,9 +19,9 @@ export function GET() {
1919
}
2020
```
2121

22-
Clicking the button now works.
22+
これでボタンクリックしたときの動作が動くようになりました。
2323

24-
Request handlers must return a [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response/Response) object. Since it's common to return JSON from an API route, SvelteKit provides a convenience function for generating these responses:
24+
リクエストハンドラーは [Response](https://developer.mozilla.org/ja/docs/Web/API/Response/Response) オブジェクトを返さなければなりません。API ルートから JSON を返すことはよくあることなので、SvelteKit はこのようなレスポンスを生成する便利な関数を提供しています。
2525

2626
```js
2727
/// file: src/routes/roll/+server.js

0 commit comments

Comments
 (0)