Skip to content

vertical-blank/graphql-spring-boot

Repository files navigation

Spring Boot / GraphQL / DOMA2

参考にしたもの

DDL

create table book (
id serial,
name text,
page_count Int,
author_id int
);

create table author (
id serial,
first_name text,
last_name Int
);
insert into book values
    (default, 'Harry Potter and the Philosopher''s Stone', 223, 1),
    (default,'Moby Dick',635, 2),
    (default, 'Interview with the vampire', 371, 3);

insert into author values
    (default,'Joanne','Rowling'),
    (default,'Herman','Melville'),
    (default,'Anne','Rice');

起動

./gradlew bootrun

クエリ

curl --request POST \
  --url http://localhost:8080/graphql \
  --header 'content-type: application/json' \
  --data '{"query":"{ bookById(id: 2) { id name pageCount author { firstName lastName } } }"}'
{"data":{"bookById":{"id":2,"name":"Moby Dick","pageCount":635,"author":{"firstName":"Herman","lastName":"Melville"}}}}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages