Beginner Go Question
I have this directory structure.
app_executable
html
|
- index.html
data
|
- static_file.json
I can't get it to serve the static_file.json
in data/static_file.json
.
func main() {
// this works and serves html/index.html
html := http.FileServer(http.Dir("html"))
http.Handle("/", html)
// this always 404's
data := http.FileServer(http.Dir("data"))
http.Handle("/data/", data)
fmt.Println("Listening on port " + port + "...")
log.Fatal(http.ListenAndServe(port, nil))
}
Any help is appreciated!