Created
February 22, 2012 05:26
-
-
Save sam/1881677 to your computer and use it in GitHub Desktop.
Harbor::Controller
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
require "pathname" | |
require Pathname(__FILE__).dirname.parent + "lib/harbor" | |
class Foo < Harbor::Application | |
class Bar < Harbor::Controller | |
# GET: /bar/baz | |
get "baz" do | |
response.puts "Hello World!" | |
end | |
# GET: /baz | |
get "/baz" do | |
response.puts "One of these is not like the other..." | |
end | |
# GET: /bar | |
get do | |
response.puts "It's all relative baby!" | |
end | |
# GET: / | |
get "/" do | |
response.puts "I'm Home!" | |
end | |
# GET: /bar/baz/:zed | |
get "baz/:zed" do |zed| | |
response.puts "WILDCARD!: #{zed}" | |
end | |
# GET: /categories/:category_id/posts/:post_id | |
get "/categories/:category_id/posts/:post_id" do |category_id, post_id| | |
response.puts "Looking for #{post_id} in #{category_id}..." | |
end | |
end | |
end | |
run Harbor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment