<div dir="ltr"><div><div><div><div><div><div><div><div><div>handle(Req, State) -><br>
handle_method(cowboy_req:get(method, Req), Req, State). will require<br><br><br></div>handle_method(<<"GET">>, Req, State)<br>handle_method(<<"DELETE">>, Req, State)<br>handle_method(Other, Req, State)<br>
</div> here we copy from module to module default reply on "method not supported" or 404, whatever we choose.<br><br><br></div>with method constraints code can look so:<br><br><br></div>init(_, Req, [Action]) -><br>
</div> {ok, Req, Action}.<br><br><br></div>handle(Req, show) -><br> ..<br><br></div>handle(Req, destroy) -><br> ..<br><br></div>handle(Req, list) -><br> ..<br> .<br><br></div>And no "default handler" because it is not required. Only good requests can pass to this handler.<br>
<br><br>
</div>