I'm started learing Erlang. I want to write simple cowboy-based HTTP server, which can receive files sending via HTTP POST. So I create simple handler:
-module(handler).
-behaviour(cowboy_http_handler).
-export([init/3,handle/2,terminate/3]).
init({tcp, http}, Req, _Opts) ->
{ok, Req, undefined_state}.
handle(Req, State) ->
Body = <<"<h1>Test</h1>">>,
{ok, Req2} = cowboy_req:reply(200, [], Body, Req),
{ok, Req2, State}.
terminate(_Reason, _Req, _State) ->
ok.
This code can handle GET request. But how can I process HTTP POST request?