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.
我的 Sinatra 应用程序中有这条路线:
post ':type/new' do data = JSON.parse request.body.read id = $database.add_instance(params[:type], data['content']) id.to_json end
现在,当我发布到/wombat/new它返回 404,建议我添加post '/wombat/new'到我的路线。
/wombat/new
post '/wombat/new'
为什么它不匹配那条路线?
尝试
post '/:type/new' do ...
(注意前导/)。
/