Skip to content

Ruby GraphQL API serving an educational reference of the 8 trigrams of the ancient Chinese I-Ching.

Notifications You must be signed in to change notification settings

ajtran303/graphql_trigrams

Repository files navigation

Trigrams

A GraphQL API for querying the eight trigrams.

Setup

bundle install
rails db:{create,migrate,seed}

Tests

rails db:seed RAILS_ENV=test
bundle exec rspec

Development

rails db:seed RAILS_ENV=production
rails s -p 3000

In your browser, go to:

http://localhost:3000/graphiql

Sample Query

query fetchTrigram {
  trigram(id: 1) {
    id
    trigram
    binary
    element
  }
}

Sample response

{
  "data": {
    "trigram": {
      "id": "1",
      "trigram": "☰",
      "binary": "111",
      "element": "Heaven/Firmament"
    }
  }
}

Production

To use the GraphiQL Interface, go to:

https://graphql-trigrams.herokuapp.com/graphiql

Example curl:

curl --request POST \
-H "Content-Type: application/json" \
-d '{"query":"query{trigram(id:5) {id trigram binary element}}"}' \
https://graphql-trigrams.herokuapp.com/graphql

Sample response:

{"data":{"trigram":{"id":"5","trigram":"","binary":"011","element":"Wind"}}}

About

Ruby GraphQL API serving an educational reference of the 8 trigrams of the ancient Chinese I-Ching.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages