gen_router v0.1.6 GenRouter

Router to parse messages, modeled by the idea of simplified Plug.Conn router.

Link to this section Summary

Functions

Custom router factory

Defines default route or a route inside a pipeline

Defines a pipeline to send the connection through

Defines a plug pipeline

Defines a plug inside a pipeline

Defines scope of routers with pipelines

Link to this section Functions

Link to this macro

__using__(opts) (macro)

Custom router factory

Link to this macro

match(path, controller, action) (macro)

Defines default route or a route inside a pipeline.

See pipeline/2 for more information.

Link to this function

match_in_scope(router_module, scope, routes, scope_pipeline, path_suffix, conn, opts)
match_in_scope(
  module(),
  atom(),
  [{String.t(), atom(), atom()}],
  [atom()],
  String.t(),
  GenRouter.Conn.t(),
  Keyword.t()
) :: GenRouter.Conn.t()

Match specific route in scope of routes.

We ensure that all paths and suffixs are matched with slash for consistency.

Link to this macro

pipe_through(pipes) (macro)

Defines a pipeline to send the connection through.

See pipeline/2 for more information.

Link to this macro

pipeline(pipe, list) (macro)

Defines a plug pipeline.

Pipelines are defined at the router root and can be used from any scope.

Link to this macro

plug(plug, opts \\ []) (macro)

Defines a plug inside a pipeline.

See pipeline/2 for more information.

Link to this macro

scope(scope, scope_path, list) (macro)

Defines scope of routers with pipelines.