Example projecto for "GraphQL on Rails" tutorial:
- From zero to the first query—setting up a project, adding first queries to both back-end and front-end applications. (branch 'part-1')
- Updating the data—adding mutations. (branch 'part-2')
- On the way to perfection—adding subscriptions, and some refactoring. (branch 'part-3')
You need nodejs and yarn installed.
Run yarn && bundle && rails s to make the magic happen.
You need docker and docker-compose installed (for MacOS just use official app).
Run the following commands to prepare your Docker dev env:
$ docker-compose build
$ docker-compose run runner yarn install
$ docker-compose run runner ./bin/setupIt builds the Docker image, installs Ruby and NodeJS dependencies, creates database, run migrations and seeds.
You're all set! Now you're ready to code!
- Running the app:
You can run the Rails up using the following command:
$ docker-compose up railsIf you want to run Webpack Dev server as well:
$ docker-compose up rails webpackerYou can also use dip–CLI utility for straightforward provisioning and interacting with an applications configured by docker-compose.
To install dip copy and run the command below:
$ gem install dipThen use the following commands:
# provision application
dip provision
# run web app with all debuging capabilities (i.e. `binding.pry`)
dip rails s
# run rails console
dip rails c
# run webpacker dev server
dip up -d webpacker
# `-d` - mean that service will run in detached (background) mode