This is a boilerplate for a project using Ruby on Rails and GraphQL.
- Ruby:
3.2.2
- Rails:
7.1.2
- MySQL:
8.2.0
- graphql-ruby:
2.1.6
- Settings for Docker to build a development environment
User
andLine
models- and its seed data
- Basic GraphQL configuration
- Install
graphql-ruby
- Created
users_resolver
,user_type
,line_type
- Install
- DataLoader settings to avoid N+1 queries
- with
graphql-batch
- with
- Several gems to improve development efficiency
graphiql
、graphql-rails_logger
、dotenv-rails
$ docker-compose build
$ docker-compose up
$ docker-compose exec app sh
# rails db:create
# rails db:migrate
# rails db:seed_fu
$ open http://localhost:3000
$ open http://localhost:3000/graphiql
$ curl -X POST \
-H "Content-Type: application/json" \
--data '{ "query": "{ users { id name age } }" }' \
http://localhost:3000/graphql
{"data":{"users":[{"id":"1","name":"Goro Shigeno","age":20},{"id":"2","name":"Joe Gibson","age":41},{"id":"3","name":"Taiga Shimizu","age":18}]}}
