/graphql-blog-api

💎 Rails 5 API for a GraphQL blog and client agnostic

Primary LanguageRuby

GraphQL Blog API

This repository is a Rails 5 API for a GraphQL blog and client agnostic. It does not contain a client to consume the API, but does include GraphiQL in development. See graphql-blog-client for a client implementation that consumes this GraphQL endpoint.

Technologies

  • Rails 5
  • PostgreSQL
  • graphql-ruby - GraphQL-Ruby is a Ruby implementation of GraphQL.
  • graphiql - GraphiQL is an in-browser IDE for exploring GraphQL.
  • rack-cors - Rack Middleware for handling Cross-Origin Resource Sharing (CORS), which makes cross-origin AJAX possible.
  • optics-agent - Apollo Optics agent for GraphQL Monitoring in Ruby

Features

  • Get a list of recent posts or recent users
  • Get a post, comment or user
  • Create a post, comment or user
  • GraphiQL for local debugging, schema exploration and documentation

Setup

  • Install bundler
    • gem install bundler
  • Clone the repository
    • git clone git@github.com:Skovy/graphql-blog-api.git
  • Change to the GraphQL Blog API directory
    • cd graphql-blog-api
  • Install the gem dependencies
    • bundle install
  • Copy local environment variables and configure as necessary
    • cp .env.example .env
  • Create and migrate the database
    • rails db:create
    • rails db:migrate
  • Create fake seed data (optional)
    • rails db:seed
  • Start the server
    • foreman start
  • Play around with GraphiQL (/graphiql) or hit the GraphQL (/graphql) endpoint

Next Steps

  • One step Heroku Deployment
  • Authentication