Last active
May 6, 2019 06:13
-
-
Save icqparty/13e04dc97885a2384d9385e5c28667c3 to your computer and use it in GitHub Desktop.
Серфинг фронетенда на go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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