View Source erf_router (erf v0.1.2)
Summary
Functions
Generates an Erlang Syntax Tree of a router module from an API AST.
Handles an HTTP request.
Loads a router module into the Erlang Runtime System.
Types
-type callback() :: module().
-type generator_opts() :: #{callback := callback(), static_routes := [erf:static_route()]}.
-type t() :: erl_syntax:syntaxTree().
Functions
-spec generate(API, Opts) -> Result when API :: erf:api(), Opts :: generator_opts(), Result :: {Mod, Router}, Mod :: module(), Router :: t().
-spec handle(Name, Request) -> Result when Name :: atom(), Request :: erf:request(), Result :: erf:response().