Sending a DELETE request from Sinatra

前端 未结 5 1699
没有蜡笔的小新
没有蜡笔的小新 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 04:13

    I thinks it's like the Rails way. You need define a params '_method' with 'delete' value and add it on your form.

    When you POST you form with this particular params, you do a DELETE request in sinatra.

    Like :

    It's the same with PUT method

提交回复
热议问题