title: serving static files with plumber package - files not found (404)
body: <p>I want to serve a static file with <a href="https://cran.r-project.org/web/packages/plumber/index.html" rel="nofollow"><code>plumber</code></a> as described <a href="http://plumber.trestletech.com/docs/static/" rel="nofollow">here</a>. The file with the routes etc. is <code>server.R</code>:</p>
  
  <pre><code>#* @get /files
  function()
  {
    return(dir("files"))
  }
  
  #* @static ./files
  list() 
  </code></pre>
  
  <p>This should make the <code>files</code> directory available on the path <code>/public</code>. Inside <code>files</code> there is a file <code>index.html</code>. Running above code:</p>
  
  <pre><code>library(plumber)
  r &lt;- plumb("server.R")
  r$run()
  </code></pre>
  
  <p>Calling <code>localhost:8000/files</code> returns:</p>
  
  <pre><code>["index.html"]
  </code></pre>
  
  <p>However, calling <code>localhost:8000/public/index.html</code> gives a 404 error:</p>
  
  <pre><code>{"error":["404 - Resource Not Found"]}
  </code></pre>
  
  <p>Printing the <code>r</code> object, the public path appears to be defined:</p>
  
  <pre><code>&gt; r
  &lt;plumber&gt;
    Public:
      addAssets: function (dir, path = "/public", options = list()) 
      ...
  </code></pre>
  
  <p><strong>Any ideas where I go wrong?</strong></p>