ewebmachine v2.0.5

Modules summary

Ewebmachine

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

Ewebmachine.Builder.Handlers

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)

Ewebmachine.Builder.Resources

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

Ewebmachine.Core.Utils

HTTP utility module

Ewebmachine.Handlers

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

Ewebmachine.Plug.Debug

A ewebmachine debug UI at /wm_debug

Ewebmachine.Plug.ErrorAsForward

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

Ewebmachine.Plug.Run

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

Ewebmachine.Plug.Send

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

Exceptions summary

Ewebmachine.Plug.ErrorAsException

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