Skip to content

Instantly share code, notes, and snippets.

@icqparty
Last active May 6, 2019 06:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icqparty/13e04dc97885a2384d9385e5c28667c3 to your computer and use it in GitHub Desktop.
Save icqparty/13e04dc97885a2384d9385e5c28667c3 to your computer and use it in GitHub Desktop.
Серфинг фронетенда на go
func main() {
base_path := "../frontend/dist"
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
path := ""
if r.URL.Path == "/" {
path = base_path + "/index.html"
} else {
path = base_path + r.URL.Path
}
log.Println(path)
http.ServeFile(w, r, path)
})
http.ListenAndServe(":9090", nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment