View Source Orbit.Pipe behaviour (Orbit v0.3.0)
The interface for request middleware.
Pipes are analogous to the behaviour of Plug
. Requests enter the Orbit.Endpoint
and are passed through a series of pipes
that sequentially process the request, and at the end of the pipeline the response is sent to the client.
A pipe may also be simple 2-arity anonymous function that implements the same typespec as call/2
.
When you use Orbit.Router
or use Orbit.Controller
, the call/2
callback is injected into the module,
turning it into a Pipe.
Summary
Callbacks
Handle a request.
Functions
Trigger a pipe.
Callbacks
@callback call(req :: Orbit.Request.t(), arg :: any()) :: Orbit.Request.t()
Handle a request.
Takes in a a Request, potentially modifies it, and returns a Request. The arg
can be any value and is
Pipe-dependenent.
Functions
Trigger a pipe.