erf (erf v0.1.2)
View Sourceerf
is a library that provides a design-first framework to build RESTful APIs in Erlang.
Summary
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().