Re: Static site server

29 views
Skip to first unread message

Michele

unread,
Oct 24, 2013, 7:47:53 AM10/24/13
to rr...@googlegroups.com
I think I'm having a similar issue (different outcome but same root cause). Basically, I noticed that when Brewery applies to the same folders that store the Static files, these file are incorrectly sent to the client. I know you have a different problem but can you try move "down" one folder index.html (and any other file to be brew()ed) like:

s$add(name="myapp", 
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"
)

Hope that helps.
Michele.



On Friday, 3 May 2013 15:07:49 UTC+1, David A Springate wrote:
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? 
Reply all
Reply to author
Forward
0 new messages