here でplumber
説明されているように、静的ファイルを提供したいと思います。ルートなどを含むファイルは次のとおりです。server.R
#* @get /files
function()
{
return(dir("files"))
}
#* @static ./files
list()
これfiles
により、パスでディレクトリが使用可能になります/public
。中files
にファイルがありますindex.html
。上記のコードを実行:
library(plumber)
r <- plumb("server.R")
r$run()
呼び出しのlocalhost:8000/files
戻り値:
["index.html"]
ただし、呼び出すとlocalhost:8000/public/index.html
404 エラーが発生します。
{"error":["404 - Resource Not Found"]}
オブジェクトを印刷するr
と、パブリック パスが定義されているように見えます。
> r
<plumber>
Public:
addAssets: function (dir, path = "/public", options = list())
...
私が間違っているアイデアはありますか?