and this will start a simple static web server on 0.0.0.0:5000 that serves up the current directory as static files. We don't have a simple way to do this with httpuv, this is the equivalent invocation:
httpuv::runServer(app = list(staticPaths=list("/"=httpuv::staticPath(getwd()))), host = "0.0.0.0", port = 5000)
It would be great to have a single function for this, with parameters for:
host (default: 0.0.0.0 or 127.0.0.1?)
port (default: hardcoded value)
directory (default: getwd())
OR, maybe we create a convenience function to create list(staticPaths=list("/"=httpuv::staticPath(getwd()))) and that becomes the default value for the app parameter of runServer and startServer. Like runServer <- function(host, port, app=staticSite("."), ...)
My motivation for this is to help the story of distributing Shinylive/webR HTML/JS/CSS bundles to end users on Windows, where Python may not be installed. Those bundles cannot be run with the file: protocol, it must be http(s). I'd love to be able to tell them "you can start a little local web server with either python -m http.server or R -e 'httpuv::runServer()'".
In Python you can do this from a shell:
and this will start a simple static web server on 0.0.0.0:5000 that serves up the current directory as static files. We don't have a simple way to do this with httpuv, this is the equivalent invocation:
It would be great to have a single function for this, with parameters for:
getwd()
)OR, maybe we create a convenience function to create
list(staticPaths=list("/"=httpuv::staticPath(getwd())))
and that becomes the default value for theapp
parameter ofrunServer
andstartServer
. LikerunServer <- function(host, port, app=staticSite("."), ...)
My motivation for this is to help the story of distributing Shinylive/webR HTML/JS/CSS bundles to end users on Windows, where Python may not be installed. Those bundles cannot be run with the file: protocol, it must be http(s). I'd love to be able to tell them "you can start a little local web server with either
python -m http.server
orR -e 'httpuv::runServer()'
".cc @rpodcast @wch