Sha256: 3e56312edd4418ac7719ce73fa0f013291bb71dec7d22c152b0c1eb2c0761a90
Contents?: true
Size: 1.95 KB
Versions: 2
Compression:
Stored size: 1.95 KB
Contents
# Rasti::Web [![Gem Version](https://badge.fury.io/rb/rasti-web.svg)](https://rubygems.org/gems/rasti-web) [![Build Status](https://travis-ci.org/gabynaiman/rasti-web.svg?branch=master)](https://travis-ci.org/gabynaiman/rasti-web) [![Coverage Status](https://coveralls.io/repos/gabynaiman/rasti-web/badge.svg?branch=master)](https://coveralls.io/r/gabynaiman/rasti-web?branch=master) [![Code Climate](https://codeclimate.com/github/gabynaiman/rasti-web.svg)](https://codeclimate.com/github/gabynaiman/rasti-web) Web blocks to build robust applications ## Installation Add this line to your application's Gemfile: gem 'rasti-web' And then execute: $ bundle Or install it yourself as: $ gem install rasti-web ## Usage ### Routing ```ruby # app.rb class WebApp < Rasti::Web::Application use SomeMiddleware get '/hello' do |request, response, render| render.text 'world' end put '/users/:id', UsersController >> :update end # configu.ru require_relative 'app' run WebApp ``` ### Controllers ```ruby class UsersController < Rasti::Web::Controller def update user = User.find(params[:id]) if user.update_attributes(params[:user]) render.view 'users/list', users: User.all else render.view 'users/edit', user: user end end end ``` ### Hooks ```ruby class UsersController < Rasti::Web::Controller before_action do |action_name| end before_action :action_name do end after_action do |action_name| end after_action :action_name do end end ``` ### Error handling ```ruby class UsersController < Rasti::Web::Controller rescue_from StandardError do |ex| render.status 500, 'Unexpected error' end end ``` ## Contributing 1. Fork it ( https://github.com/gabynaiman/rasti-web/fork ) 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create a new Pull Request
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rasti-web-2.1.1 | README.md |
rasti-web-2.1.0 | README.md |