Sending a DELETE request from Sinatra

前端 未结 5 1687
没有蜡笔的小新
没有蜡笔的小新 2021-02-04 03:27

I am trying to develop a RESTful Sinatra application. Now, I know how to respond to a delete request with something like

delete \'/user/:id\' do |id|
   #do some         


        
5条回答
  •  孤独总比滥情好
    2021-02-04 03:59

    Put following line in your code.

    use Rack::MethodOverride
    

    It will help you interpret post methods with parameter "_method" with value "delete" as put. Then you can write

    delete '/user/:id' do |id|
    

提交回复
热议问题