hasura-rest-hands-on/docs/create-rest-endpoint.md
2021-07-16 22:27:19 +09:00

1.1 KiB

REST APIエンドポイントの作成

get page GET page/:id

query getPage($id: Int!) {
  page: pages_by_pk(id: $id) {
    id
    content
  }
}

put page PUT page/:id

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
  }
}