Search code examples
rshinyshiny-server

Shiny path to root folder?


I have not installed a Shiny server and I would prefer that I did not. When I run runApp from RStudio I have a browser window opened at address localhost:port. I would like this application to read data from disk. At which path do I need to place this data in order for the client (index.html) to be able to do window.open(path/data) and a new window would open showing the raw data?

I have in index.html

Shiny.addCustomMessageHandler ("callbackHandler",
    function (value)
    {
        window.open(value.file);
    });

and in server.R

session$sendCustomMessage (type = "callbackHandler", message = list (file = trackfile, ...));

Solution

  • runApp doesnt serve files. It listens on the given port and serves the one app on that port. Files can be accessed from the server side at www and made accessible to the ui etc.

    If you want to have files served you will need to have a seperate http server running like python simplehttpserver or servr github.com/yihui/servr or the R rook package.