Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 30 lines (24 sloc) 0.539 kb
#!/usr/bin/env ruby
$:<< '../lib' << 'lib'
require 'goliath/api'
require 'goliath/runner'
# Example demonstrating how to use a custom Goliath runner
#
class Hello < Goliath::API
def response(env)
[200, {}, "hello!"]
end
end
class Bonjour < Goliath::API
def response(env)
[200, {}, "bonjour!"]
end
end
class Custom < Goliath::API
map "/hello", Hello
map "/bonjour", Bonjour
end
runner = Goliath::Runner.new(ARGV, nil)
runner.api = Custom.new
runner.app = Goliath::Rack::Builder.build(Custom, runner.api)
runner.run
Jump to Line
Something went wrong with that request. Please try again.