I want to serve a static file with plumber
as described here. The file with the routes etc. is server.R
:
#* @get /files
function()
{
return(dir("files"))
}
#* @static ./files
list()
This should make the files
directory available on the path /public
. Inside files
there is a file index.html
. Running above code:
library(plumber)
r <- plumb("server.R")
r$run()
Calling localhost:8000/files
returns:
["index.html"]
However, calling localhost:8000/public/index.html
gives a 404 error:
{"error":["404 - Resource Not Found"]}
Printing the r
object, the public path appears to be defined:
> r
<plumber>
Public:
addAssets: function (dir, path = "/public", options = list())
...
Any ideas where I go wrong?