View Source erf_router (erf v0.1.2)

Summary

Functions

Generates an Erlang Syntax Tree of a router module from an API AST.
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().
Generates an Erlang Syntax Tree of a router module from an API AST.
-spec load(Router) -> Result
              when
                  Router :: t(),
                  Result :: ok | {ok, Warnings} | error | {error, {Errors, Warnings}},
                  Errors :: [term()],
                  Warnings :: [term()].
Loads a router module into the Erlang Runtime System.