Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 使用管道工软件包提供静态文件-未找到文件(404)_R_Plumber - Fatal编程技术网

R 使用管道工软件包提供静态文件-未找到文件(404)

R 使用管道工软件包提供静态文件-未找到文件(404),r,plumber,R,Plumber,我想提供一个静态文件,如下所述。包含路由等的文件是server.R: #* @get /files function() { return(dir("files")) } #* @static ./files list() 这将使路径/public上的文件目录可用。在文件中有一个文件index.html。运行上述代码: library(plumber) r <- plumb("server.R") r$run() 但是,调用localhost:8000/public/index

我想提供一个静态文件,如下所述。包含路由等的文件是
server.R

#* @get /files
function()
{
  return(dir("files"))
}

#* @static ./files
list() 
这将使路径
/public
上的
文件
目录可用。在
文件中
有一个文件
index.html
。运行上述代码:

library(plumber)
r <- plumb("server.R")
r$run()
但是,调用
localhost:8000/public/index.html
会出现404错误:

{"error":["404 - Resource Not Found"]}
打印
r
对象时,公共路径似乎已定义:

> r
<plumber>
  Public:
    addAssets: function (dir, path = "/public", options = list()) 
    ...
>r
公众:
addAssets:function(dir,path=“/public”,options=list())
...

我哪里出了问题?我是罪魁祸首。。。我悄悄地为静态文件服务器重命名了注释,而且(显然)从未更新文档

我在这里添加了一个工作示例:,但新注释是
@assets
,而不是
@static
。我会很快更新文档

> r
<plumber>
  Public:
    addAssets: function (dir, path = "/public", options = list()) 
    ...