Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding regex route

  • Loading branch information...
commit 4d20d5ddfc2ffd7f7635ef85f0ec39a5809506f6 1 parent 711a871
@jc00ke authored
Showing with 14 additions and 0 deletions.
  1. +5 −0 example/sinazzy.rb
  2. +9 −0 sinatra/sinatra.md
View
5 example/sinazzy.rb
@@ -17,3 +17,8 @@
put '/change/something' do
"Changed or something"
end
+
+get %r{/I/am/([\d]+)/years/old} do |age|
+ puts age # write to the logger. sometimes helpful.
+end
+
View
9 sinatra/sinatra.md
@@ -101,4 +101,13 @@
$ curl localhost:4567/i/dislike/puppies
I dislike puppies too!
+!SLIDE
+# You like regular expressions, right? #
+
+ @@@ ruby
+
+ get %r{/I/am/([\d]+)/years/old} do |age|
+ puts age # write to the logger. sometimes helpful.
+ end
+
Please sign in to comment.
Something went wrong with that request. Please try again.