有没有办法一起使用地图和(莲花)路由器命名空间?下面是config.ru
我试图作为演示运行的示例。
require 'bundler'
Bundler.require
module Demo
class Application
def initialize
@app = Rack::Builder.new do
map '/this_works' do
run Proc.new {|env| [200, {"Content-Type" => "text/html"}, ["this_works"]]}
end
map '/api' do
run Lotus::Router.new do
get '/api/', to: ->(env) { [200, {}, ['Welcome to Lotus::Router!']] }
get '/*', to: ->(env) { [200, {}, ["This is catch all: #{ env['router.params'].inspect }!"]] }
end
end
end
end
def call(env)
@app.call(env)
end
end
end
run Demo::Application.new