Skip to content
Browse files

Formatted code-block in README.

  • Loading branch information...
1 parent b7611ea commit edc66ae569b948003f5dd133eb9e20edb248d571 @dstrelau dstrelau committed Jun 23, 2011
Showing with 2 additions and 0 deletions.
  1. +2 −0 README.md
View
2 README.md
@@ -41,10 +41,12 @@ Once you have a route object, use `HttpRouter::Route#to` to add a destination an
e.g.
+```ruby
r = HttpRouter.new
r.add('/test/:variable(.:format)').name(:my_test_path).to {|env| [200, {}, "Hey dude #{env['router.params'][:variable]}"]}
r.add('/test').redirect("http://www.google.com/")
r.add('/static').static('/my_file_system')
+```
As well, you can support regex matching and request conditions. To add a regex match, use `matching(:id => /\d+/)`.
To match on a request condition you can use `condition(:request_method => %w(POST HEAD))` or more succinctly `request_method('POST', 'HEAD')`.

0 comments on commit edc66ae

Please sign in to comment.
Something went wrong with that request. Please try again.