A working example of a Grape API mounted alongside Rails app that uses Trailblazer with Service Object Pattern / DDD.
- Rails
- Grape
- Trailblazer
- PostgreSQL
- Elasticsearch
Using default model directory app/models from Rails. Handle primitive database only.
In directory app/concepts/*/repository. Handle any persistent transaction.
In directory app/concepts/*/contract. Handle any use case validation.
In directory app/concepts/*/entity. Handle response to endpoint.
In directory app/concepts/*/operation. Handle use case / business process.
In directory app/concepts/*/policy. Handle user permission to use case.
In directory app/controllers/API. Handle endpoint API.
- Clone the repository
- bundle install
- rake db:create
- rake db:migrate
- rake db:seed
- rails s
- Check swagger doc on http://localhost:3000/doc
- Go to Auth and then click Explore button
- Generate token
- Use the token to play around in main API
- rake db:test:prepare
- rspec
Copyright
Use whatever you wish if this repository inspire you