Skip to content

Instantly share code, notes, and snippets.

@mzemel
Created October 3, 2014 18:16
Show Gist options
  • Save mzemel/64da9dc30efe0e330d83 to your computer and use it in GitHub Desktop.
Save mzemel/64da9dc30efe0e330d83 to your computer and use it in GitHub Desktop.
Sinatra Example
# gem install sinatra
# sinatra.rb
require 'rubygems'
require 'sinatra'
get "/" do
"This is the main page"
end
get "/first" do
"This is the first page"
end
get "/second" do
name = params[:name]
"Hello, #{name}. This is the second page"
end
# ruby sinatra.rb
# == Sinatra/1.4.5 has taken the stage on 4567 for development with backup from Thin
# Thin web server (v1.6.2 codename Doc Brown)
# Maximum connections set to 1024
# Listening on localhost:4567, CTRL+C to stop
# visit localhost:4567
# see "This is the main page"
# etc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment