SlideShare a Scribd company logo
1 of 108
== Sinatra has taken to the stage with backup from
Matt Gifford
@coldfumonkeh
www.monkehworks.com
“SWING WHEN YOU’RE WINNING”
AN INTRODUCTION TO
SINATRA & RUBY
I build stuff
and I write about building stuff too
WHAT WE’LL COVER:
Getting your first Sinatra project up and running
What is Sinatra?
Brief overview of a Sinatra application structure
Handling routes and formats
Deploying to Heroku *
* other options do exist
LIVE CODE DEMOS?
WHAT COULD POSSIBLY
GO WRONG?
NOT SURE IF I SHOULD BE HERE
OR WATCHING SOMEONE ELSE
WHAT ELSE IS ON?
Using personas in service design - continuously
Mura 6 for developers
Tuüli Aalto-Nyyssonen
Steve Withington
WAIT!
You’re a ColdFusion developer, aren’t you?
And this is a ColdFusion conference, isn’t it?
YES I AM!
(and proud of it)
BACK TO SINATRA
WHY NOT RAILS?
It is awesome though...
Rails is quite large and sometimes too much
monkeh$ rails create [stuff]
Ships with ORM, routes, test suites etc
Easily installed with RubyInstaller(.org)
SO WHY SINATRA?
Doesn’t force any framework
Extremely lightweight
A Domain Specific Language (DSL)
Incredibly quick and simple
(but plays well with others if you want to)
SO WHY SINATRA?
Runs on Rack
Can be a single file web application
Can use a number of JavaScript libraries
Can use a number of template engines
It also means I can show pictures like this...
MORE BOUNCE TO THE OUNCE
DEVELOPMENT IS QUICK!
“simplicityistheultimate
sophistication”
Leonardo da Vinci
SINATRA IS GREAT FOR
REST APIs
Small apps
useful for AJAX calls to data
Keeping your simple application simple
If it gets too big, consider using Rails (or CF)
HOW SIMPLE?
application.rb
require 'rubygems'
require 'sinatra'
get '/hi' do
"Hello World!"
end
THIS SIMPLE!
monkeh$ ruby application.rb
== Sinatra/1.4.2 has taken to the stage on 4567 for development with
backup from Thin
>> Thin web server (v1.5.1 codename Straight Razor)
>> Maximum connections set to 1024
>> Listening on localhost:4567, CTRL+C to stop
RUNNING THE APP
IMPRESSIVE, RIGHT?
require 'rubygems'
require 'sinatra'
get '/hi' do
"Hello World!"
end
WHAT’S GOING ON?
require 'rubygems'
require 'sinatra'
get '/hi' do
"Hello World!"
end
WHAT’S GOING ON?
<--- Ruby package manager
require 'rubygems'
require 'sinatra'
get '/hi' do
"Hello World!"
end
WHAT’S GOING ON?
<--- Ruby package manager
<--- Sinatra gem
require 'rubygems'
require 'sinatra'
get '/hi' do
"Hello World!"
end
WHAT’S GOING ON?
<--- Ruby package manager
<--- Sinatra gem
<--- GET request
require 'rubygems'
require 'sinatra'
get '/hi' do
"Hello World!"
end
WHAT’S GOING ON?
<--- Ruby package manager
<--- Sinatra gem
<--- GET request
<--- response
require 'rubygems'
require 'sinatra'
get '/hi' do
"Hello World!"
end
NO RETURN?
<--- the return is implied
get '/hi' do
"Hello World!"
end
ROUTE BLOCKS
<--- this is a route block
A route block is an HTTP method paired with
a URL-matching pattern.
Processing takes place within the block (database calls etc)
and the result is sent to the browser.
REST
Uniform Interface
Client-Server
Cacheable
HATEOAS
Layered System
Stateless
Hypermedia as the Engine
of Application State
SINATRA CAN DO THAT!
Caching
Multiple Routes
Content Types
All HTTP verbs supported
Good times!
REST
get '/' do
.. show something ..
end
post '/' do
.. create something ..
end
put '/' do
.. replace something ..
end
patch '/' do
.. modify something ..
end
delete '/' do
.. annihilate something ..
end
options '/' do
.. appease something ..
end
link '/' do
.. affiliate something ..
end
unlink '/' do
.. separate something ..
end
ROUTES
get '/' do
"Home page"
end
get '/hello' do
"Hello!"
end
get '/hello/:name' do
"Hello! #{params[:name]}"
end
ROUTES
get '/say/*/to/*' do
# matches /say/hello/to/world
params[:splat] # => ["hello", "world"]
end
get '/download/*.*' do
# matches /download/path/to/file.xml
params[:splat] # => ["hello", "world"]
end
get '/download*.*' do |path, ext|
# matches /download/path/to/file.xml
[path, ext] # => ["path/to/file", "xml"]
end
ROUTES
get %r{/hello/([w]+)} do
"Hello, #{params[:captures].first}!"
end
get '/posts.?:format?' do
# matches "/posts " and any extension
# eg "GET /posts.xml" or "GET /posts.json"
end
ROUTES
get '/hi', :agent => /Mozilla/(d.d)sw?/ do
"You’re using Mozilla version #{params[:agent][0]}"
end
get '/hi' do
# matches all non-Mozilla browsers
end
GETTING STARTED
Install Ruby
Bathe in Ruby deliciousness
Create your application file
Install the Sinatra gem
http://rvm.io
monkeh$ rvm install 1.9.3
monkeh$ rvm use --default 1.9.3
monkeh$ rvm use jruby
http://cheat.errtheblog.com/s/rvm
GEMS?
GEMS?
RubyGem distributes libraries
apt-get
Similar in functionality to:
A library is self-contained in a gem
portage
yum
GEMS!
monkeh$ gem install [gem]
monkeh$ gem uninstall [gem]
monkeh$ gem list
monkeh$ gem fetch [gem]
BACK TO SINATRA
INSTALLING
monkeh$ gem install sinatra
monkeh$ gem install shotgun
DEMO TIME
DIRECTORY STRUCTURE
| -- application.rb
SINGLE PAGE APP
application.rb
require 'rubygems'
require 'sinatra'
get '/' do
html = '<form method="post">'
html += '<input type="text" placeholder="Add the URL to shorten here..."'
html += 'name="url" id="url" />'
html += '<input type="submit" value="Shorten!" />'
html += '</form>'
html
end
post '/' do
html = '<p>Thanks for submitting a URL.</p>'
html
end
VIEWS
Multiple template languages available, including:
builder
erb
haml
sass
liquid
markdown
USING VIEWS
application.rb
require 'rubygems'
require 'sinatra'
get '/' do
erb :index
end
post '/' do
erb :index
end
views/index.erb
<form method="post">
<input type="text" placeholder="Add the URL to shorten here..."
name="url" id="url" />
<input type="submit" value="Shorten!" />
</form>
DIRECTORY STRUCTURE
| -- application.rb
| -- views
-- index.erb
LAYOUTS
A template that calls yield to draw in view data
Can also be managed through route blocks
A template called “layout” will be used by default
USING LAYOUTS
views/layout.erb
<!DOCTYPE html>
<html>
<head>
<title>Sinatra Intro</title>
</head>
<body>
<%= yield %>
</body>
</html>
views/index.erb
<form method="post">
<input type="text" placeholder="Add the URL to shorten here..."
name="url" id="url" />
<input type="submit" value="Shorten!" />
</form>
USING LAYOUTS
views/layout.erb
<!DOCTYPE html>
<html>
<head>
<title>Sinatra Intro</title>
</head>
<body>
<%= yield %>
</body>
</html>
views/index.erb
<form method="post">
<input type="text" placeholder="Add the URL to shorten here..."
name="url" id="url" />
<input type="submit" value="Shorten!" />
</form>
DIRECTORY STRUCTURE
| -- application.rb
| -- views
-- index.erb
-- layout.erb
STATIC CONTENT
All static content is stored within a new directory
“public”
This is primarily for
Javascript
CSS
Images
DIRECTORY STRUCTURE
| -- application.rb
| -- views
-- index.erb
-- layout.erb
| -- public
-- css
-- style.css
-- javascript
STATIC CONTENT?
HELPERS
application.rb
helpers do
def random_string(length
)
rand(36**length).to_s(36)
end
def get_site_url(short_url
)
'http://' + request.host + '/' + short_url
end
def generate_short_url(long_url
@shortcode = random_string 5
get_site_url(@shortcode)
end
end
FILTERS
application.rb
# This code will run before each event
# Very useful for debugging parameters sent via the console
before do
puts '[Params]'
p params
end
# This code will run after each event
after do
puts response.status
end
CONFIGURATION
Will run once at startup
Can be used to
set application-wide values and options
perform certain processes per environment
CONFIGURATION
configure do
# All environments
end
configure :production do
# Production only
end
configure :development, :test do
# Development and Test
end
CONFIGURATION
configure do
set :variable, 'foo'
# multiple options
set :variable1 => 'Hello', :variable2 => 'world'
# same as set :option, true
enable :option
# same as set :option, false
disable :option
end
get '/' do
settings.variable? # => true
settings.variable # => 'foo'
end
CONFIGURATION
configure :development do
# very useful for debugging parameters sent via the console
before do
puts '[Params]'
p params
end
end
DATAMAPPER
Same API can talk to multiple datastores
Uses adapters to achieve this
sqlite
mysql
postgresql
DATAMAPPER
Define mappings in your model
Comes bundled with tools to assist with
migration
constraints
transactions
timestamps
validations
...and more!
INCLUDE THE LIBRARY
application.rb
require 'rubygems'
require 'sinatra'
require 'data_mapper' <--- DataMapper gem
CONFIGURATION
application.rb
configure do
# load models
$LOAD_PATH.unshift("#{File.dirname(__FILE__)}/lib"
)
Dir.glob("#{File.dirname(__FILE__)}/lib/*.rb") { |lib|
require File.basename(lib, '.*')
}
DataMapper::setup(:default, "sqlite3://#{Dir.pwd}/myDatabase.db")
DataMapper.finalize
DataMapper.auto_upgrade!
end
MODEL
lib/short_url.rb
class ShortURL
include DataMapper::Resource
property :short_url, String, key: true, unique_index: true, required: true
property :url, Text, required: true
property :created_at, DateTime
property :updated_at, DateTime
end
SAVING DATA
application.rb
def generate_short_url(long_url
@shortcode = random_string 5
su = ShortURL.first_or_create(
{ :url => long_url },
{
:short_url => @shortcode,
:created_at => Time.now,
:updated_at => Time.now
})
get_site_url(su.short_url)
end
GETTING DATA
application.rb
# root page
get '/' do
# get the current object of all links stored
@urls = ShortURL.all;
erb :index
end
views/index.erb
<h1>Serving <%= @urls.count %> links</h1>
GETTING DATA
application.rb
get '/:short_url' do
@URLData = ShortURL.get(params[:short_url])
end
DIRECTORY STRUCTURE
| -- application.rb
| -- views
-- index.erb
-- layout.erb
| -- public
-- css
-- style.css
-- javascript
| -- lib
-- shorturl.rb
CONTENT TYPES
Return content in a number of formats, including
JSON
XML
HTML
monkeh$ gem install json
May need some more gems to process
CONTENT TYPE
application.rb
get '/' do
if params[:url] and not params[:url].empty?
@shortURL = generate_short_url(params[:url])
content_type :json
{
:original_url => params[:url],
:short_url => @shortURL
}.to_json
else
# get the current count of all links stored
@urls = ShortURL.all;
erb :index
end
end
TESTING
WHY?
BECAUSE!
TESTING GEMS
monkeh$ gem install rspec
monkeh$ gem install rack
monkeh$ gem install rack/test
TESTING WITH RSPEC
spec/application_rspec.rb
require_relative '../application.rb'
require 'rack/test'
set :environment, :test
def app
Sinatra::Application
end
describe 'URL Shortening Service' do
include Rack::Test::Methods
it "should load the home page" do
get '/'
last_response.should be_ok
end
end
AUTO TESTING
monkeh$ gem install ZenTest
AUTO TESTING NOTIFICATIONS
monkeh$ gem install autotest-growl
monkeh$ gem install autotest-fsevent
DIRECTORY STRUCTURE
| -- application.rb
| -- views
-- index.erb
-- layout.erb
| -- public
-- css
-- style.css
-- javascript
| -- lib
-- shorturl.rb
| -- spec
-- application_rspec.rb
http://gembundler.com/v1.3/gemfile.html
monkeh$ gem install bundler
Gemfile
source 'https://rubygems.org'
gem 'sinatra'
gem 'json'
gem 'dm-core'
gem 'dm-migrations'
gem 'dm-postgres-adapter'
group :development do
gem 'shotgun'
end
group :production do
gem 'thin'
end
GEMFILE
monkeh$ bundle install
monkeh$ git add Gemfile Gemfile.lock
BUNDLE TIME
CONFIG.RU
Many reasons to use, but especially if..
you are deploying to a different Rack handler
Heroku
Passenger
config.ru
require './application.rb'
run Sinatra::Application
CONFIG.RU
Procfile
web: bundle exec thin -R config.ru start -p $PORT -e $RACK_ENV
PROCFILE
HEROKU DEPLOYMENT
monkeh$ git init
monkeh$ git add .
monkeh$ git commit -m "Initial commit"
monkeh$ heroku create urlshrinkapp
Creating urlshrinkapp... done, stack is cedar
http://urlshrinkapp.herokuapp.com/ | git@heroku.com:urlshrinkapp.git
Git remote heroku added
HEROKU
monkeh$ git push heroku master
Total 19 (delta 2), reused 0 (delta 0)
-----> Ruby/Rack app detected
-----> Installing dependencies using Bundler version 1.3.2
Running: bundle install --without development:test --path vendor/bundle --binstubs
vendor/bundle/bin --deployment
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Installing data_objects (0.10.13)
Installing dm-core (1.2.0)
Installing dm-do-adapter (1.2.0)
Installing dm-migrations (1.2.0)
Installing do_postgres (0.10.13)
Installing dm-postgres-adapter (1.2.0)
Installing eventmachine (1.0.3)
Installing json (1.8.0)
Installing rack (1.5.2)
Installing rack-protection (1.5.0)
Installing tilt (1.4.1)
Installing sinatra (1.4.2)
Using bundler (1.3.2)
Your bundle is complete! It was installed into ./vendor/bundle
Cleaning up the bundler cache.
-----> Discovering process types
Procfile declares types -> web
Default types for Ruby/Rack -> console, rake
-----> Compiled slug size: 3.0MB
-----> Launching... done, v4
http://urlshrinkapp.herokuapp.com deployed to Heroku
To git@heroku.com:urlshrinkapp.git
* [new branch] master -> master
HEROKU
monkeh$ heroku addons:add heroku-postgresql:dev
Adding heroku-postgresql:dev on urlshrinkapp... done, v5 (free)
Attached as HEROKU_POSTGRESQL_BROWN_URL
Database has been created and is available
heroku pg:promote HEROKU_POSTGRESQL_BROWN_URL
Promoting HEROKU_POSTGRESQL_BROWN_URL to DATABASE_URL... done
HEROKU
monkeh$ heroku run console
Running `console` attached to terminal... up, run.2858
irb(main):001:0> require './application.rb'
=> true
irb(main):002:0> DataMapper.auto_upgrade!
=> #<DataMapper::DescendantSet:0x000000035aacf0
@descendants=#<DataMapper::SubjectSet:0x000000035aaca0
@entries=#<DataMapper::OrderedSet:0x000000035aac78
@cache=#<DataMapper::SubjectSet::NameCache:0x000000035aac50
@cache={"ShortURL"=>0}>, @entries=[ShortURL]>>>
irb(main):003:0> exit
HEROKU
monkeh$ heroku open
Opening urlshrinkapp... done
HEROKU
DIRECTORY STRUCTURE
| -- application.rb
| -- views
-- index.erb
-- layout.erb
| -- public
-- css
-- style.css
-- javascript
| -- Gemfile
| -- lib
| -- spec
| -- config.ru
| -- Procfile
BACK TO SINATRA
USEFUL LINKS
http://sinatrarb.com
https://github.com/sinatra/sinatra
http://rvm.io
== Sinatra has ended his set (crowd applauds)

More Related Content

What's hot

Oscar: Rapid Iteration with Vagrant and Puppet Enterprise - PuppetConf 2013
Oscar: Rapid Iteration with Vagrant and Puppet Enterprise - PuppetConf 2013Oscar: Rapid Iteration with Vagrant and Puppet Enterprise - PuppetConf 2013
Oscar: Rapid Iteration with Vagrant and Puppet Enterprise - PuppetConf 2013Puppet
 
Vagrant: Your Personal Cloud
Vagrant: Your Personal CloudVagrant: Your Personal Cloud
Vagrant: Your Personal CloudJames Wickett
 
Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725miguel dominguez
 
Using Sinatra to Build REST APIs in Ruby
Using Sinatra to Build REST APIs in RubyUsing Sinatra to Build REST APIs in Ruby
Using Sinatra to Build REST APIs in RubyLaunchAny
 
EC2 AMI Factory with Chef, Berkshelf, and Packer
EC2 AMI Factory with Chef, Berkshelf, and PackerEC2 AMI Factory with Chef, Berkshelf, and Packer
EC2 AMI Factory with Chef, Berkshelf, and PackerGeorge Miranda
 
Automate with Ansible basic (2/e, English)
Automate with Ansible basic (2/e, English)Automate with Ansible basic (2/e, English)
Automate with Ansible basic (2/e, English)Chu-Siang Lai
 
Quick & Easy Dev Environments with Vagrant
Quick & Easy Dev Environments with VagrantQuick & Easy Dev Environments with Vagrant
Quick & Easy Dev Environments with VagrantJoe Ferguson
 
Usando o Cloud
Usando o CloudUsando o Cloud
Usando o CloudFabio Kung
 
Vagrant: The Oscar Plug-in
Vagrant: The Oscar Plug-inVagrant: The Oscar Plug-in
Vagrant: The Oscar Plug-inJeff Scelza
 
Webinar - Auto-deploy Puppet Enterprise: Vagrant and Oscar
Webinar - Auto-deploy Puppet Enterprise: Vagrant and OscarWebinar - Auto-deploy Puppet Enterprise: Vagrant and Oscar
Webinar - Auto-deploy Puppet Enterprise: Vagrant and OscarOlinData
 
Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!
Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!
Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!Puppet
 
Taking the Friction Out of Ticket Investigation (Standardized Debugging Envir...
Taking the Friction Out of Ticket Investigation (Standardized Debugging Envir...Taking the Friction Out of Ticket Investigation (Standardized Debugging Envir...
Taking the Friction Out of Ticket Investigation (Standardized Debugging Envir...Atlassian
 
Chasing AMI - Building Amazon machine images with Puppet, Packer and Jenkins
Chasing AMI - Building Amazon machine images with Puppet, Packer and JenkinsChasing AMI - Building Amazon machine images with Puppet, Packer and Jenkins
Chasing AMI - Building Amazon machine images with Puppet, Packer and JenkinsTomas Doran
 
Development with Ansible & VMs
Development with Ansible & VMsDevelopment with Ansible & VMs
Development with Ansible & VMsJeff Schenck
 
Automacao devops
Automacao devopsAutomacao devops
Automacao devopsFabio Kung
 
Small Python Tools for Software Release Engineering
Small Python Tools for Software Release EngineeringSmall Python Tools for Software Release Engineering
Small Python Tools for Software Release Engineeringpycontw
 
Ansible を完全にマスターする
Ansible を完全にマスターするAnsible を完全にマスターする
Ansible を完全にマスターするKeisuke Kamada
 
Handling 10k requests per second with Symfony and Varnish - SymfonyCon Berlin...
Handling 10k requests per second with Symfony and Varnish - SymfonyCon Berlin...Handling 10k requests per second with Symfony and Varnish - SymfonyCon Berlin...
Handling 10k requests per second with Symfony and Varnish - SymfonyCon Berlin...Alexander Lisachenko
 

What's hot (19)

Oscar: Rapid Iteration with Vagrant and Puppet Enterprise - PuppetConf 2013
Oscar: Rapid Iteration with Vagrant and Puppet Enterprise - PuppetConf 2013Oscar: Rapid Iteration with Vagrant and Puppet Enterprise - PuppetConf 2013
Oscar: Rapid Iteration with Vagrant and Puppet Enterprise - PuppetConf 2013
 
Vagrant: Your Personal Cloud
Vagrant: Your Personal CloudVagrant: Your Personal Cloud
Vagrant: Your Personal Cloud
 
Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725
 
Using Sinatra to Build REST APIs in Ruby
Using Sinatra to Build REST APIs in RubyUsing Sinatra to Build REST APIs in Ruby
Using Sinatra to Build REST APIs in Ruby
 
EC2 AMI Factory with Chef, Berkshelf, and Packer
EC2 AMI Factory with Chef, Berkshelf, and PackerEC2 AMI Factory with Chef, Berkshelf, and Packer
EC2 AMI Factory with Chef, Berkshelf, and Packer
 
Automate with Ansible basic (2/e, English)
Automate with Ansible basic (2/e, English)Automate with Ansible basic (2/e, English)
Automate with Ansible basic (2/e, English)
 
Quick & Easy Dev Environments with Vagrant
Quick & Easy Dev Environments with VagrantQuick & Easy Dev Environments with Vagrant
Quick & Easy Dev Environments with Vagrant
 
Usando o Cloud
Usando o CloudUsando o Cloud
Usando o Cloud
 
Vagrant: The Oscar Plug-in
Vagrant: The Oscar Plug-inVagrant: The Oscar Plug-in
Vagrant: The Oscar Plug-in
 
Webinar - Auto-deploy Puppet Enterprise: Vagrant and Oscar
Webinar - Auto-deploy Puppet Enterprise: Vagrant and OscarWebinar - Auto-deploy Puppet Enterprise: Vagrant and Oscar
Webinar - Auto-deploy Puppet Enterprise: Vagrant and Oscar
 
Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!
Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!
Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!
 
Taking the Friction Out of Ticket Investigation (Standardized Debugging Envir...
Taking the Friction Out of Ticket Investigation (Standardized Debugging Envir...Taking the Friction Out of Ticket Investigation (Standardized Debugging Envir...
Taking the Friction Out of Ticket Investigation (Standardized Debugging Envir...
 
Chasing AMI - Building Amazon machine images with Puppet, Packer and Jenkins
Chasing AMI - Building Amazon machine images with Puppet, Packer and JenkinsChasing AMI - Building Amazon machine images with Puppet, Packer and Jenkins
Chasing AMI - Building Amazon machine images with Puppet, Packer and Jenkins
 
bivou.ac
bivou.acbivou.ac
bivou.ac
 
Development with Ansible & VMs
Development with Ansible & VMsDevelopment with Ansible & VMs
Development with Ansible & VMs
 
Automacao devops
Automacao devopsAutomacao devops
Automacao devops
 
Small Python Tools for Software Release Engineering
Small Python Tools for Software Release EngineeringSmall Python Tools for Software Release Engineering
Small Python Tools for Software Release Engineering
 
Ansible を完全にマスターする
Ansible を完全にマスターするAnsible を完全にマスターする
Ansible を完全にマスターする
 
Handling 10k requests per second with Symfony and Varnish - SymfonyCon Berlin...
Handling 10k requests per second with Symfony and Varnish - SymfonyCon Berlin...Handling 10k requests per second with Symfony and Varnish - SymfonyCon Berlin...
Handling 10k requests per second with Symfony and Varnish - SymfonyCon Berlin...
 

Viewers also liked

Simple Web Services With Sinatra and Heroku
Simple Web Services With Sinatra and HerokuSimple Web Services With Sinatra and Heroku
Simple Web Services With Sinatra and HerokuOisin Hurley
 
10mentalbarrierstoletgoof 12861929353381 Phpapp01
10mentalbarrierstoletgoof 12861929353381 Phpapp0110mentalbarrierstoletgoof 12861929353381 Phpapp01
10mentalbarrierstoletgoof 12861929353381 Phpapp01ana_ls
 
Ruby and Sinatra's Shotgun Wedding
Ruby and Sinatra's Shotgun WeddingRuby and Sinatra's Shotgun Wedding
Ruby and Sinatra's Shotgun WeddingJamin Guy
 
Coimbra rb | microservic'ing and sinatra
Coimbra rb | microservic'ing and sinatraCoimbra rb | microservic'ing and sinatra
Coimbra rb | microservic'ing and sinatralinkedcare
 
WTF Is Messaging And Why You Should Use It?
WTF Is Messaging And Why You Should Use It?WTF Is Messaging And Why You Should Use It?
WTF Is Messaging And Why You Should Use It?James Russell
 
Message Queues in Ruby - An Overview
Message Queues in Ruby - An OverviewMessage Queues in Ruby - An Overview
Message Queues in Ruby - An OverviewPradeep Elankumaran
 
Lightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClientLightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClientAdam Wiggins
 

Viewers also liked (7)

Simple Web Services With Sinatra and Heroku
Simple Web Services With Sinatra and HerokuSimple Web Services With Sinatra and Heroku
Simple Web Services With Sinatra and Heroku
 
10mentalbarrierstoletgoof 12861929353381 Phpapp01
10mentalbarrierstoletgoof 12861929353381 Phpapp0110mentalbarrierstoletgoof 12861929353381 Phpapp01
10mentalbarrierstoletgoof 12861929353381 Phpapp01
 
Ruby and Sinatra's Shotgun Wedding
Ruby and Sinatra's Shotgun WeddingRuby and Sinatra's Shotgun Wedding
Ruby and Sinatra's Shotgun Wedding
 
Coimbra rb | microservic'ing and sinatra
Coimbra rb | microservic'ing and sinatraCoimbra rb | microservic'ing and sinatra
Coimbra rb | microservic'ing and sinatra
 
WTF Is Messaging And Why You Should Use It?
WTF Is Messaging And Why You Should Use It?WTF Is Messaging And Why You Should Use It?
WTF Is Messaging And Why You Should Use It?
 
Message Queues in Ruby - An Overview
Message Queues in Ruby - An OverviewMessage Queues in Ruby - An Overview
Message Queues in Ruby - An Overview
 
Lightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClientLightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClient
 

Similar to Build a simple URL shortener with Sinatra

Strangers In The Night: Ruby, Rack y Sinatra - Herramientas potentes para con...
Strangers In The Night: Ruby, Rack y Sinatra - Herramientas potentes para con...Strangers In The Night: Ruby, Rack y Sinatra - Herramientas potentes para con...
Strangers In The Night: Ruby, Rack y Sinatra - Herramientas potentes para con...Alberto Perdomo
 
Rails Presentation (Anton Dmitriyev)
Rails Presentation (Anton Dmitriyev)Rails Presentation (Anton Dmitriyev)
Rails Presentation (Anton Dmitriyev)True-Vision
 
Your first sinatra app
Your first sinatra appYour first sinatra app
Your first sinatra appRubyc Slides
 
Socket applications
Socket applicationsSocket applications
Socket applicationsJoão Moura
 
Ruby プログラマのための Perl ウェブアプリケーション開発入門 (Perl web development guide for Rubyist )
Ruby プログラマのための Perl ウェブアプリケーション開発入門 (Perl web development guide for Rubyist )  Ruby プログラマのための Perl ウェブアプリケーション開発入門 (Perl web development guide for Rubyist )
Ruby プログラマのための Perl ウェブアプリケーション開発入門 (Perl web development guide for Rubyist ) Kensuke Nagae
 
Making Spinnaker Go @ Stitch Fix
Making Spinnaker Go @ Stitch FixMaking Spinnaker Go @ Stitch Fix
Making Spinnaker Go @ Stitch FixDiana Tkachenko
 
Rapid Prototyping FTW!!!
Rapid Prototyping FTW!!!Rapid Prototyping FTW!!!
Rapid Prototyping FTW!!!cloudbring
 
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...Matt Raible
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby TeamArto Artnik
 
Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725MortazaJohari
 
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...Yevgeniy Brikman
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.catPablo Godel
 
Kuby, ActiveDeployment for Rails Apps
Kuby, ActiveDeployment for Rails AppsKuby, ActiveDeployment for Rails Apps
Kuby, ActiveDeployment for Rails AppsCameron Dutro
 
Consegi 2010 - Dicas de Desenvolvimento Web com Ruby
Consegi 2010 - Dicas de Desenvolvimento Web com RubyConsegi 2010 - Dicas de Desenvolvimento Web com Ruby
Consegi 2010 - Dicas de Desenvolvimento Web com RubyFabio Akita
 
#CNX14 - Using Ruby for Reliability, Consistency, and Speed
#CNX14 - Using Ruby for Reliability, Consistency, and Speed#CNX14 - Using Ruby for Reliability, Consistency, and Speed
#CNX14 - Using Ruby for Reliability, Consistency, and SpeedSalesforce Marketing Cloud
 

Similar to Build a simple URL shortener with Sinatra (20)

Sinatra for REST services
Sinatra for REST servicesSinatra for REST services
Sinatra for REST services
 
Strangers In The Night: Ruby, Rack y Sinatra - Herramientas potentes para con...
Strangers In The Night: Ruby, Rack y Sinatra - Herramientas potentes para con...Strangers In The Night: Ruby, Rack y Sinatra - Herramientas potentes para con...
Strangers In The Night: Ruby, Rack y Sinatra - Herramientas potentes para con...
 
Rails Presentation (Anton Dmitriyev)
Rails Presentation (Anton Dmitriyev)Rails Presentation (Anton Dmitriyev)
Rails Presentation (Anton Dmitriyev)
 
Mojolicious
MojoliciousMojolicious
Mojolicious
 
Your first sinatra app
Your first sinatra appYour first sinatra app
Your first sinatra app
 
Socket applications
Socket applicationsSocket applications
Socket applications
 
Sinatra
SinatraSinatra
Sinatra
 
Ruby プログラマのための Perl ウェブアプリケーション開発入門 (Perl web development guide for Rubyist )
Ruby プログラマのための Perl ウェブアプリケーション開発入門 (Perl web development guide for Rubyist )  Ruby プログラマのための Perl ウェブアプリケーション開発入門 (Perl web development guide for Rubyist )
Ruby プログラマのための Perl ウェブアプリケーション開発入門 (Perl web development guide for Rubyist )
 
Making Spinnaker Go @ Stitch Fix
Making Spinnaker Go @ Stitch FixMaking Spinnaker Go @ Stitch Fix
Making Spinnaker Go @ Stitch Fix
 
Rapid Prototyping FTW!!!
Rapid Prototyping FTW!!!Rapid Prototyping FTW!!!
Rapid Prototyping FTW!!!
 
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby Team
 
Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725
 
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 
Kuby, ActiveDeployment for Rails Apps
Kuby, ActiveDeployment for Rails AppsKuby, ActiveDeployment for Rails Apps
Kuby, ActiveDeployment for Rails Apps
 
Consegi 2010 - Dicas de Desenvolvimento Web com Ruby
Consegi 2010 - Dicas de Desenvolvimento Web com RubyConsegi 2010 - Dicas de Desenvolvimento Web com Ruby
Consegi 2010 - Dicas de Desenvolvimento Web com Ruby
 
Sprockets
SprocketsSprockets
Sprockets
 
#CNX14 - Using Ruby for Reliability, Consistency, and Speed
#CNX14 - Using Ruby for Reliability, Consistency, and Speed#CNX14 - Using Ruby for Reliability, Consistency, and Speed
#CNX14 - Using Ruby for Reliability, Consistency, and Speed
 
Docker, c'est bonheur !
Docker, c'est bonheur !Docker, c'est bonheur !
Docker, c'est bonheur !
 

More from Matt Gifford

Get Grulping with JavaScript Task Runners
Get Grulping with JavaScript Task RunnersGet Grulping with JavaScript Task Runners
Get Grulping with JavaScript Task RunnersMatt Gifford
 
Automating PhoneGap Build
Automating PhoneGap BuildAutomating PhoneGap Build
Automating PhoneGap BuildMatt Gifford
 
Let jQuery Rock Your World
Let jQuery Rock Your WorldLet jQuery Rock Your World
Let jQuery Rock Your WorldMatt Gifford
 
Accessing ColdFusion Services From Flex Applications
Accessing ColdFusion Services From Flex ApplicationsAccessing ColdFusion Services From Flex Applications
Accessing ColdFusion Services From Flex ApplicationsMatt Gifford
 
ColdFusion as a Service
ColdFusion as a ServiceColdFusion as a Service
ColdFusion as a ServiceMatt Gifford
 
OAuth: demystified (hopefully)
OAuth: demystified (hopefully)OAuth: demystified (hopefully)
OAuth: demystified (hopefully)Matt Gifford
 
Darwin Development
Darwin DevelopmentDarwin Development
Darwin DevelopmentMatt Gifford
 

More from Matt Gifford (7)

Get Grulping with JavaScript Task Runners
Get Grulping with JavaScript Task RunnersGet Grulping with JavaScript Task Runners
Get Grulping with JavaScript Task Runners
 
Automating PhoneGap Build
Automating PhoneGap BuildAutomating PhoneGap Build
Automating PhoneGap Build
 
Let jQuery Rock Your World
Let jQuery Rock Your WorldLet jQuery Rock Your World
Let jQuery Rock Your World
 
Accessing ColdFusion Services From Flex Applications
Accessing ColdFusion Services From Flex ApplicationsAccessing ColdFusion Services From Flex Applications
Accessing ColdFusion Services From Flex Applications
 
ColdFusion as a Service
ColdFusion as a ServiceColdFusion as a Service
ColdFusion as a Service
 
OAuth: demystified (hopefully)
OAuth: demystified (hopefully)OAuth: demystified (hopefully)
OAuth: demystified (hopefully)
 
Darwin Development
Darwin DevelopmentDarwin Development
Darwin Development
 

Recently uploaded

New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 

Recently uploaded (20)

New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 

Build a simple URL shortener with Sinatra