This gem helps you to build a Ruby on Rails REST API faster, using a scaffold-like generator that follows the best practices.
⚡ Quick Start: docs
📚 Documentation: docs
The gems use vanilla Rails generators in combination with our templates to create all the resources needed to build a REST API.
Following Switch Dreams's coding practices, the controllers are built with:
-
We use an error module to centralize error handling, rescuing from a custom and some of ActiveRecord exceptions. The inspiration for this strategy was this article
-
For tests, we use RSpec and FactoryBot.
- Automatic rest api crud generation
- Nested Resource
- 🥅 Modular error handler
- 📝 Automated documentation
- Resource ordering
- Resource filter
- Resource pagination
- Resource serialization
- Configurable
- Callbacks
- Integration with AVO
- Select fields
- User auth module
This gem resolves a very common problem so the are a lot of alternative in the market.
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can
also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the
version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version,
push git commits and the created tag, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/SwitchDreams/rest-api-generator. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
The gem is available as open source under the terms of the MIT License.