app=Builder$new(
Static$new(
urls = c("/css", "/img", "/js", "/resources"),root = "~/github/myapp/testsite/testsite/"),
Brewery$new(
url="/brew",
root="~/github/myapp/testsite/testsite/"),
Redirect$new("/brew/index.html")
)
I am building a simple development server for hosting a local static site in R. I am using the following code:
s <- Rhttpd$new()
s$start("localhost:8080")
## End(Not run)
s$add(name="myapp",
app=Builder$new(
Static$new(
urls = c("/css", "/img", "/js", "/resources"),
root = "~/github/myapp/testsite/testsite/"),
Brewery$new(url="/",root="~/github/myapp/testsite/testsite/"),
Redirect$new("/index.html")))
s$browse("myapp")
This lets me see the page index.html ok (at address localhost:40238/custom/myapp/index.html), but none of the local links are correct, for example a link <a href="research.html">Research</a> doesn't run relative to the root directory specified in the code, but links to localhost:40238/research.html. The same happens with the js and css includes in the page. When I edit the address bar directly (e.g. to localhost:40238/custom/myapp/research.html), the browser shows the file I want.
Please can you help me with getting the paths from the links correct?