Learn R Programming

routr (version 1.0.0)

route_stack: Combine routes in a stack

Description

This function allows you to combine multiple routes into a stack in order to dispatch on them until one of them returns FALSE. This allows you to have a router that can pass a request through multiple handlers before sending it along to the client or other middleware

Usage

route_stack(x, ...)

# S3 method for default route_stack(x, ...)

# S3 method for Route route_stack(x, ...)

# S3 method for AssetRoute route_stack(x, ...)

# S3 method for RouteStack route_stack(x, ..., .after = NULL)

Value

A RouteStack object. If x is a RouteStack then this will be returned, modified.

Arguments

x

A Route or RouteStack object

...

one or more named Route objects

.after

Where in the stack should the new routes be placed. NULL means place them at the end.

Examples

Run this code
# Create an empty route stack
route_stack()

# Stack a route with another, returning a RouteStack
route(all = list("*" = function(...) TRUE)) |>
  route_stack(
    limit = sizelimit_route()
  )

Run the code above in your browser using DataLab