route_merge: Merge one route into another

View source: R/tidy_api.R

route_mergeR Documentation

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)

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

Value

x with route merged into it

Examples


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


thomasp85/routr documentation built on April 13, 2025, 10:36 a.m.