Stacko
Stacko provides a simple way to layer middleware functionality around your Ruby application core use cases. Although Stacko uses a dsl inspired by Rack, it is not a server interface.
Installation
Add this line to your application's Gemfile:
gem 'stacko'
And then execute:
$ bundle
Or install it yourself as:
$ gem install stacko
Usage
class Application < Stacko::Application
use LoggingMiddleware
map(:login) do
run login_use_case
end
use AuthenticationMiddleware
map(:get_current_user) do
run login_use_case
end
map(:create_user) do
run create_user_use_case
end
end
app = Application.new
app.get_current_user(:token => user_session_token) # => returns current user entity
app.login(:username => 'johndoe', :password => 'password123') #=> 'user-session-23wm4n0oidsf9874kjjhg4j5g3mb234bm234b2'
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request