Plumber: Pass multiple files in plumb method

Created on 17 Jul 2018  路  3Comments  路  Source: rstudio/plumber

Is it possible to pass multiple file in plumb method?

question

Most helpful comment

Currently no.


You can mount multiple routers into a larger router though.

library(plumber)
f1_pr <- plumber$new("FILE_1.R")
f2_pr <- plumber$new("FILE_2.R")

master_pr <- plumber$new()
master_pr$mount("/f1", f1_pr)
master_pr$mount("/f2", f2_pr)

All of the routes of f1_pr will start with the path /f1. And with f2, all of it's routes will start with /f2.

All 3 comments

it is better to use this way
if(!exists("initiate", mode="function")) source(paste0(props['r_script_path', 1], "include_utils.r"))

Currently no.


You can mount multiple routers into a larger router though.

library(plumber)
f1_pr <- plumber$new("FILE_1.R")
f2_pr <- plumber$new("FILE_2.R")

master_pr <- plumber$new()
master_pr$mount("/f1", f1_pr)
master_pr$mount("/f2", f2_pr)

All of the routes of f1_pr will start with the path /f1. And with f2, all of it's routes will start with /f2.

See #266

Was this page helpful?
0 / 5 - 0 ratings

Related issues

actuarialvoodoo picture actuarialvoodoo  路  6Comments

EDiLD picture EDiLD  路  4Comments

dmenne picture dmenne  路  4Comments

colearendt picture colearendt  路  4Comments

daxilshah picture daxilshah  路  4Comments