Created
April 11, 2012 02:10
-
-
Save oogali/2356389 to your computer and use it in GitHub Desktop.
Sinatra route examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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