This project is an example of how to use GraphQL with Ruby on Rails.
- Ruby 3.2.2
- Rails 7.0.8
- Clone the repository:
git clone https://github.com/yourusername/yourproject.git
- Install the gems:
bundle install
- Create and migrate the database:
rails db:create && rails db:migrate
Run the tests using RSpec:
rspec
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
}
}
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
|-- ...
We welcome contributions! If you'd like to contribute, follow these steps:
- Fork the repository.
- Create a new branch: git checkout -b my-contribution
- Make your changes and commit: git commit -am 'Add new features'
- Push your changes: git push origin my-contribution
- Open a pull request.
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!