MacPorts
$ port install erlang git gmake
diff --git a/c_src/lg_tracer.c b/c_src/lg_tracer.c | |
index 8551dbc..6110d7a 100644 | |
--- a/c_src/lg_tracer.c | |
+++ b/c_src/lg_tracer.c | |
@@ -111,6 +111,9 @@ NIF_FUNCTION(enabled) | |
ERL_NIF_TERM tracers, value; | |
ErlNifPid tracer; | |
+ // @todo We can go one step further by having the one pid | |
+ // in its own value in the map, skipping a get_map_value step. |
$ port install erlang git gmake
[{h1,<<"cowboy_req:method(3)">>}, | |
{h2,<<"Name">>}, | |
{p,[<<"cowboy_req:method - HTTP method">>]}, | |
{h2,<<"Description">>}, | |
{listing,#{language => <<"erlang">>}, | |
<<"method(Req :: cowboy_req:req()) -> Method :: binary()">>}, | |
{p,[<<"Return the request's HTTP method.">>]}, | |
{p,[<<"The method can also be obtained using pattern matching:">>]}, | |
{listing,#{language => <<"erlang">>},<<"#{method := Method} = Req.">>}, | |
{h2,<<"Arguments">>}, |
cowboy_req(3) Cowboy Function Reference cowboy_req(3) | |
NAME | |
cowboy_req - HTTP request and response | |
DESCRIPTION | |
The module cowboy_req provides functions to access, manipulate and | |
respond to requests. | |
There are four types of functions in this module. They can be differ‐ |
COWBOY:START_CLEAR(3) COWBOY:START_CLEAR(3) | |
NAME | |
cowboy:start_clear - Listen for connections using plain TCP | |
DESCRIPTION | |
start_clear(Name :: ranch:ref(), | |
NumAcceptors :: non_neg_integer(), | |
TransportOpts :: ranch_tcp:opts(), | |
ProtocolOpts :: opts()) |
-module(fw_resource). | |
-type resource() :: module(). | |
-type uri() :: string(). | |
-type relation() :: index | self | ... | |
-type action() :: fetch | stream | create | replace | append | process | delete | patch | atom(). | |
-type media_type() :: atom(). | |
-type internal_representation() :: any(). | |
-type request() :: ... |
include erlang.mk | |
ifdef SKIP_DEPS | |
deps:: | |
$(verbose) for dep in $(ALL_APPS_DIRS) ; do \ | |
mkdir -p $$dep/ebin; \ | |
done | |
$(verbose) for dep in $(ALL_APPS_DIRS) ; do \ | |
$(MAKE) -C $$dep IS_APP=1 || exit $$?; \ | |
done |
A common concern with REST APIs is how do you version them? The answer is often something like put the version in the beginning of the URI path. But that’s a terrible advice. This prevents you to make small updates to your API, because you need to duplicate everything every time you increase the version.
A good way to version an API is to not do it. Instead, you can version the media types.
-module(map_req). | |
-export([init/2]). | |
init(#{method := <<"GET">>} = Req, State) -> | |
cowboy_req:reply(204, Req), | |
{ok, Req, State}. |