Hi,
I'm pretty new to R and plumber so forgive a beginners question.
I have a typical tree-like api endpoint structure:
/api/health
/api/info
/api/data/upload
/api/data/items
etc.
For each I have an endpoint script health.R
, info.R
... with proper path annotations (e.g. @get /api/health
).
Now I want to combine everything in a router.
But the straightforward approach
router <- pr() %>% pr_mount("/", "health.R") %>% pr_mount("/", "info.R") ...
doesn't work because the second pr_mount
will overwrite the first one.
Option 2:
using pr_mount("/api/health", "health.R")
works but in health.R I need to specifiy at least @get /
so my endpoint end with an "/", which is not what I want.
I didn't find a better way, but maybe I just don't get it!
Best,
Christoph