7. Sinatra is.
Is a Ruby web frameworkIt's written in Ruby. dah
It's based in URLs, get, put, delete..
Sinatra is a very simple, yet powerful,
Domain Specific Language (DSL) +RESTful
http://www.sinatrarb.com/
8. Advantages
Its, simple, only have what you need.Better performance than Rails.
You can use gems. There is life beyond Rails.Templates, Views, supports
*all of them. good for? API implmentations, quick demos, minimal
applications, widgets..
9. Disadvantages
No Rails mystical magic, forgot it.Everything from scratch,
only your needs.Isn't the best MVC frameworkNot so
popular, than others
10. Lets go!
Installing the core, yeah, we'll need
rocks, stars, and mud
Create a folder, install ruby, group
all the gems in a single gemset.
11. Define which ruby, your gemset name,
and enable them by default.
* rvm is your only friend.
$ mkdir ~/rubyc/ && cd ~/rubyc;
$ touch .rvmrc && open .rvmrc;
Paste:
rvm 1.9.1@rubyc --create
Reload your bash, let rvm bring the magic!
12. Manage your gems with Gemfile and
Bundler
Install bundler, use a Gemfile to declare all your required gems,
repositories, version locking stuff, etc.
$ gem install bundler;
$ touch Gemfile && open Gemfile;
Paste :
source :rubygems
gem 'sinatra'
Use bundler to install and maintain them.
$ bundle install;
13. Step 1 / 19
Create your App.
$ touch rubyc.rb && gedit rubyc.rb
Paste:
require 'sinatra'
get '/' do
"It works!"
end
get '/hi:name' do
"Hello #{params[:name]}!"
end