Hi
I try to create an application that serves both static and dynamic
content. The idea is that when the user points to a url a template is
rendered that has relative links to images. In code it resembles sth
like that:
func main() {
http.HandleFunc("/fen", FenHandler)
http.Handle("/pieces", http.FileServer(http.Dir("/home/spyros/src/
sandbox/board/pieces")))
http.ListenAndServe(":8080", nil)
}
This way it seems to ignore /pieces. If i point with a browser to
http://localhost:8080/pieces/board.jpg i get a 404 and the text
response "404 page not found". Using /pieces i get the same response.
If i hit
http://localhost:8080/ i get the directory listing but the
links still return 404. The first url /fen works correctly but it does
not display the images but broken links. The urls in the template are
relative like "../pieces/wbb.jpg"
So to understand the api, it is permissible to mix static and dynamic
content or i should revert to url parsing and http.ServeFile for each
image?
I tried to get a hint by looking at the app engine demos but there the
static content directory is declared in app.yaml so i guess it is
handled by GAE and the url does not go to a http.Handler
Thanks
Spyros