mirror of
https://github.com/kou029w/hasura-rest-hands-on.git
synced 2025-02-27 19:05:17 +00:00
36 lines
1.1 KiB
Markdown
36 lines
1.1 KiB
Markdown
# REST APIエンドポイントの作成
|
|
|
|

|
|
|
|
get page
|
|
GET page/:id
|
|
|
|
```graphql
|
|
query getPage($id: Int!) {
|
|
page: pages_by_pk(id: $id) {
|
|
id
|
|
content
|
|
}
|
|
}
|
|
```
|
|
|
|

|
|
|
|

|
|
|
|
put page
|
|
PUT page/:id
|
|
|
|
```graphql
|
|
mutation putPage($id: Int!, $content: jsonb!) {
|
|
page: insert_pages_one(
|
|
object: { id: $id, content: $content }
|
|
on_conflict: { constraint: pages_pkey, update_columns: content }
|
|
) {
|
|
id
|
|
content
|
|
}
|
|
}
|
|
```
|
|
|
|

|