View Source Spaceboy.Middleware behaviour (Spaceboy v0.3.2)
Spaceboy server middleware, roughly similar to Plug
s plug
Middleware has to implement two functions init/1
and call/2
. For example
implementation of middleware please look at Spaceboy.Middleware.Logger
module.
Summary
Functions
Run a series of Middlewares at runtime.
Callbacks
@callback call(conn :: Spaceboy.Conn.t(), opts :: any()) :: Spaceboy.Conn.t()
Functions
@spec run(conn :: Spaceboy.Conn.t(), [{module(), Keyword.t()}]) :: Spaceboy.Conn.t()
Run a series of Middlewares at runtime.
If any of the plugs halt, the remaining plugs are not invoked. If the given connection was already halted, none of the plugs are invoked either.