API Reference ewebmachine v2.3.0

Modules

Ewebmachine is a full rewrite with clean DSL and plug integration based on Webmachine from basho. This version is not backward compatible with the previous one that was only a thin wrapper around webmachine, use the branch 1.0-legacy to use the old one.

use this module will use Plug.Builder (so a plug pipeline described with the plug module_or_function_plug macro), but gives you an :add_handler local function plug which adds to the conn the locally defined ewebmachine handlers (see Ewebmachine.Handlers).

use this module will use Plug.Builder (so a plug pipeline described with the plug module_or_function_plug macro), but gives you a :resource_match local function plug which matches routes declared with the resource/2 macro and execute the plug defined by its body.

HTTP utility module

Implement the functions described below to make decisions in the HTTP decision tree

A ewebmachine debug UI at /wm_debug

This plug checks the current response status. If it is an error, raise a plug exception with the status code and the HTTP error name as the message. If this response body is not void, use it as the exception message.

This plug take an argument forward_pattern (default to "/error/:status"), and, when the current response status is an error, simply forward to a GET to the path defined by the pattern and this status.

Plug passing your conn through the HTTP decision tree to fill its status and response.

Calling this plug will send the response and halt the connection pipeline if the conn has passed through an Ewebmachine.Plug.Run.