<div dir="ltr"><div><div><div><div><div><div><div><div>I can give you an example:<br><br></div>URL  /users/15<br><br></div>GET /users/15  should be routed to function that shows user<br></div>DELETE /users/15  should be route to function that destroys user<br>
<br></div>Currently you are forcing user to spread routing among different places:<br><br></div>"/users/:user_id", user_handler, []  and there, in init I need to check if this method is GET or DELETE or anything else<br>
<br></div>but with method constraints, it will work as following:<br><br></div>"/users/:user_id", [{method,<<"GET">>}], user_handler, [show]<br>"/users/:user_id", [{method,<<"DELETE">>}], user_handler, [destroy]<br>
<br><br></div>I don't see any HTTP pure theory violation in it. It looks rather convenient and more clear than checking which method was passed by user.<br><br></div>