Reputation: 3207
Is this a valid route handler?
post '/lists/:id/delete' do
#delete list
...
end
I can't get it to fire.
Upvotes: 0
Views: 364
Reputation: 9561
Yes, it is. But it will only fire when you do a HTTP POST request, e.g. submit a form using the post
method:
<form action="/lists/17/delete" method="post">
...
</form>
If you enter the same URL in you browser, however, a HTTP GET request will be fired. If this is what you want, you should replace post
with get
in your route.
A great place to start: http://www.sinatrarb.com/intro.
Upvotes: 1