【发布时间】:2016-04-18 07:41:07
【问题描述】:
我想使用plumber 提供静态文件,如here 所述。包含路线等的文件是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())
...
有什么想法我哪里出错了吗?
【问题讨论】: