Routex.Route (Routex v1.2.2)

View Source

Function for working with Routex augmented Phoenix Routes

Summary

Functions

Compatibility wrapper around Phoenix.Router.Route.exprs

Returns a list of unique backends

Returns the nesting level of an (ancestor) route. By default the parent. This can be adjusted by providing an negative depth offset.

Returns routes grouped by the combination of method and origin path

Returns routes grouped by nesting level of an (ancestor) route. By default groups by parent. This can be adjusted by providing an negative depth offset

Functions

exprs(route, env)

@spec exprs(Routex.Types.route(), Routex.Types.env()) :: map()

Compatibility wrapper around Phoenix.Router.Route.exprs

get_backends(routes)

@spec get_backends(Routex.Types.routes()) :: [Routex.Types.backend()]

Returns a list of unique backends

get_nesting(route, offset \\ 0)

@spec get_nesting(Routex.Types.route(), integer()) :: [integer()]

Returns the nesting level of an (ancestor) route. By default the parent. This can be adjusted by providing an negative depth offset.

group_by_method_and_origin(routes)

Returns routes grouped by the combination of method and origin path

group_by_method_and_path(routes, offset \\ 0)

@spec group_by_method_and_path(Routex.Types.routes(), integer()) :: %{
  required({atom(), binary()}) => Routex.Types.routes()
}

group_by_nesting(routes, offset \\ 0)

@spec group_by_nesting(Routex.Types.routes(), integer()) :: %{
  required([integer()]) => Routex.Types.routes()
}

Returns routes grouped by nesting level of an (ancestor) route. By default groups by parent. This can be adjusted by providing an negative depth offset