View Source erf (erf v0.1.2)
erf
is a library that provides a design-first framework to build RESTful APIs in Erlang.
Summary
Functions
Returns the router for an instance of the server.
Reloads the configuration for an instance of the server.
Starts the supervision tree for an instance of the server.
Stops the supervision tree for an instance of the server.
Types
-type api() :: erf_parser:api().
-type body() :: undefined | njson:t().
-type conf() :: #{spec_path := binary(), callback := module(), port => inet:port_number(), name => atom(), spec_parser => module(), preprocess_middlewares => [module()], postprocess_middlewares => [module()], ssl => boolean(), certfile => binary(), keyfile => binary(), static_routes => [static_route()], swagger_ui => boolean(), log_level => logger:level()}.
-type method() :: get | post | put | delete | patch | head | options | trace | connect.
-type request() :: #{scheme := undefined | binary(), host := undefined | binary(), port := undefined | 1..65535, path := [binary()], path_parameters => [path_parameter()], method := method(), query_parameters := [query_parameter()], headers := [header()], body := body(), peer := undefined | binary(), route := binary(), context => any()}.
-type response() :: {StatusCode :: pos_integer(), Headers :: [header()], Body :: body() | {file, binary()}}.
-type static_dir() :: {dir, binary()}.
-type static_file() :: {file, binary()}.
-type static_route() :: {Path :: binary(), Resource :: static_file() | static_dir()}.
Functions
-spec reload_conf(Name, Conf) -> Result when Name :: atom(), Conf :: erf_conf:t(), Result :: ok | {error, Reason}, Reason :: term().