[erlang-questions] Cowboy routes with Method as a condition

Max Lapshin max.lapshin@REDACTED
Wed Feb 13 10:05:39 CET 2013

I understand it.

But look at rails routing: you can add constraints not only on bindings,
but also on methods. It is very convenient, because it allows CRUD  routing
from routes and it makes code smaller due to removing protection of GET

If I add route:

"/items/:item/destroy", item_handler, [destroy]

than I need to check if this method is POST, because it is a very bad idea
to make any destructive action on GET.
If I add:

"items/:item/destroy", [{method,<<"POST">>}], item_handler, [destroy]

I don't need to write useless code.

Why are you against it?
Let's use not  'method', but <<"method">> or any other name that will not
clash with bindings.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130213/9225fcd2/attachment.htm>

More information about the erlang-questions mailing list