Skip to content

Instantly share code, notes, and snippets.

@oogali
Created April 11, 2012 02:10
Show Gist options
  • Save oogali/2356389 to your computer and use it in GitHub Desktop.
Save oogali/2356389 to your computer and use it in GitHub Desktop.
Sinatra route examples
# http://host.com/path?query=1234
get '/path' do
# params['query'] will contain '1234'
end
# http://host.com/path/1234
get '/path/:number' do
# params['number'] will contain '1234'
end
# http://host.com/path/1234
get '/path/:number' do |number|
# number will contain '1234'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment