On MacOS 10.14.16 with R 3.6.1 and Plumber 0.4.6, mounted routers are inaccessible. Consider the following example:
library(plumber)
root <- plumber$new()
# Mount first
first <- plumber$new()
first$handle("GET", "/echo", function(msg = "") {
list(msg = paste0("The message is '", msg, "'"))
})
root$mount("first", first)
# Mount second
second <- plumber$new()
second$handle("GET", "/add", function(x, y) {
as.numeric(x) + as.numeric(y)
})
root$mount("second", second)
root
#> # Plumber router with 0 endpoints, 4 filters, and 2 sub-routers.
#> # Call run() on this object to start the API.
#> ├──[queryString]
#> ├──[postBody]
#> ├──[cookieParser]
#> ├──[sharedSecret]
#> ├──/first
#> │ │ # Plumber router with 1 endpoint, 4 filters, and 0 sub-routers.
#> │ ├──[queryString]
#> │ ├──[postBody]
#> │ ├──[cookieParser]
#> │ ├──[sharedSecret]
#> │ └──/echo (GET)
#> ├──/second
#> │ │ # Plumber router with 1 endpoint, 4 filters, and 0 sub-routers.
#> │ ├──[queryString]
#> │ ├──[postBody]
#> │ ├──[cookieParser]
#> │ ├──[sharedSecret]
#> │ └──/add (GET)
This seems to indicate that echo would be available at /first/echo and add would be available at /second/add. However, when trying to access either of those endpoints, a 404 error is returned:
curl -X GET 'http://localhost:5762/first/echo?msg=hi'
{"error":["404 - Resource Not Found"]}
curl -X GET 'http://localhost:5762/second/add?x=1&y=9'
{"error":["404 - Resource Not Found"]}
On MacOS 10.14.16 with R 3.6.1 and Plumber 0.4.6, mounted routers are inaccessible. Consider the following example:
This seems to indicate that
echowould be available at/first/echoandaddwould be available at/second/add. However, when trying to access either of those endpoints, a 404 error is returned: