Learn R Programming

routr (version 1.0.0)

route_merge: Merge one route into another

Description

This function allows you to combine two separate routes into one. This is different from combining them in a routestack, because a request is only matched to one handler in each route (thus combining them with route_merge() will ensure only one handler is called).

Usage

route_merge(x, route, use_root = TRUE)

Value

x with route merged into it

Arguments

x, route

Route objects to merge. route will be merged into x

use_root

Should the root of route be added to all its paths before it is merged into x

Examples

Run this code
route() |>
  route_add("HEAD", "*", function(...) {
    message("Someone's looking")
    TRUE
  }) |>
  route_merge(
    sizelimit_route()
  )

Run the code above in your browser using DataLab