plumber (version 1.0.0)

pr_mount: Mount a Plumber router

Description

Plumber routers can be <U+201C>nested<U+201D> by mounting one into another using the mount() method. This allows you to compartmentalize your API by paths which is a great technique for decomposing large APIs into smaller files. This function mutates the Plumber router (pr()) in place, but also invisibly returns the updated router.

Usage

pr_mount(pr, path, router)

Arguments

pr

The host Plumber router.

path

A character string. Where to mount router.

router

A Plumber router. Router to be mounted.

Value

A Plumber router with the supplied router mounted

Examples

Run this code
# NOT RUN {
pr1 <- pr() %>%
  pr_get("/hello", function() "Hello")

pr() %>%
  pr_get("/goodbye", function() "Goodbye") %>%
  pr_mount("/hi", pr1) %>%
  pr_run()
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab