Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何将“.json”添加到包含命名参数(例如 get '/view/:name' )的 Sinatra 路由 ?
我认为 get '/view/:name.json' 可能有效,但出现“无法访问路径 /view/name.json”异常。
此代码完美运行:
get '/hello/:name.json' do "Hello #{params[:name]}" end => /hello/samy.json outputs "Hello samy"
请显示您的异常的完整堆栈跟踪。
还,
https://github.com/sinatra/sinatra/issues/490