Skip to content

Instantly share code, notes, and snippets.

@jamesalmond
Created July 5, 2011 14:34
Show Gist options
  • Save jamesalmond/1064943 to your computer and use it in GitHub Desktop.
Save jamesalmond/1064943 to your computer and use it in GitHub Desktop.
source "http://rubygems.org"
gem 'goliath', :git => "git://github.com/postrank-labs/goliath.git"
require 'bundler/setup'
require 'goliath'
class HelloWorld < Goliath::API
def response(env)
[200, {}, "Hello world"]
end
end
class NoRoutes < Goliath::API
map '/some_route', HelloWorld
end
» ruby no_routes.rb -sv
[7874:INFO] 2011-07-05 15:25:42 :: Starting server on 0.0.0.0:9000 in development mode. Watch out for stones.
# request to http://localhost:9000/some_route
[7874:INFO] 2011-07-05 15:26:17 :: Status: 200, Content-Length: 11, Response Time: 15.28ms
# request to http://localhost:9000
[7874:ERROR] 2011-07-05 15:25:49 :: stack level too deep
/Users/jamesalmond/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/set.rb:92
[7874:INFO] 2011-07-05 15:25:49 :: Status: 500, Content-Length: 17, Response Time: 26.48ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment