79537632ac
This small router is intended to work like URLMap, but with the feature that it can extract variables from routes.
17 lines
303 B
Ruby
17 lines
303 B
Ruby
require File.expand_path('../lib/zero.rb', __FILE__)
|
|
require 'json'
|
|
|
|
class Foo
|
|
def call(env)
|
|
req = Rack::Request.new(env)
|
|
[200, {'Content-Type' => 'text/html'}, ["this works #{req.params.inspect}"]]
|
|
end
|
|
end
|
|
|
|
routes = Zero::Router.new(
|
|
'/foo/:id' => Foo.new,
|
|
'/' => Foo.new
|
|
)
|
|
|
|
run routes
|