rstudio / plumber

Turn your R code into a web API.
https://www.rplumber.io
Other
1.41k stars 257 forks source link

global basepath #836

Open dseynaev opened 3 years ago

dseynaev commented 3 years ago

It would be helpful to be able to specify a global base path e.g. as an argument to pr_run(), which would be taken into account by all routers including the documentation and spec urls.

I'm currently working around this by just creating an empty root router pr() and using pr_mount() to add my actual router under a base path. This is not a complete solution since I would also like to serve my documentation under that same base path.

I found options(plumber.apiPath), which looks like it's working, but the docs are actually served under http://127.0.0.1:5297/__docs__/

>  plumber::options_plumber(apiPath = "/x")
>  plumber::pr() %>% plumber::pr_run()
Running plumber API at http://127.0.0.1:5297
Running swagger Docs at http://127.0.0.1:5297/x/__docs__/
schloerke commented 3 years ago

Correct. The docs are only mounted for the root router.

The message and the documentation do not align

aaronbrezel commented 1 year ago

Any update on this bug? Currently looking for an easy way to add a base path prefix to the default swagger documentation.

E.g.: http://127.0.0.1:8000/base_path/__docs__/

Otherwise, a suggested workaround would also be much appreciated!

JosiahParry commented 4 months ago

This bug still exists. I am able to recreate it today. How can we fix this?