rulpalacios / playingGraphql

Project to start to play with Graphql on Rails

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sample GraphQL Project with Ruby on Rails

Project Description

This project is an example of how to use GraphQL with Ruby on Rails.

Requirements

  • Ruby 3.2.2
  • Rails 7.0.8

Installation

  1. Clone the repository: git clone https://github.com/yourusername/yourproject.git
  2. Install the gems: bundle install
  3. Create and migrate the database: rails db:create && rails db:migrate

Running Tests

Run the tests using RSpec:

rspec

Using GraphQL

You can interact with the GraphQL API using GraphiQL or by making queries and mutations. Here's an example of how to create a character:

mutation {
  createCharacter(input: {
    name: "Krilin",
    race: "Human",
    powerLevel: 1000,
    universeId: 1
  }) {
    character {
      id
      name
      race
      powerLevel
      universe {
        id
        name
      }
    }
    errors
  }
}

Project Structure

The project structure follows the typical Ruby on Rails convention with models, controllers, mutations, queries, etc.

|-- app
|   |-- controllers
|   |-- models
|   |-- graphql
|       |-- mutations
|       |-- queries
|       |-- types
|-- config
|-- db
|-- ...

Contribution

We welcome contributions! If you'd like to contribute, follow these steps:

  1. Fork the repository.
  2. Create a new branch: git checkout -b my-contribution
  3. Make your changes and commit: git commit -am 'Add new features'
  4. Push your changes: git push origin my-contribution
  5. Open a pull request.

Acknowledgments

We appreciate the GraphQL, Ruby on Rails, and all the contributors to these technologies.

Feel free to adjust any parts to fit the specific details of your project. I hope this helps!

About

Project to start to play with Graphql on Rails


Languages

Language:Ruby 85.7%Language:HTML 10.6%Language:JavaScript 2.4%Language:CSS 1.4%