Add static page routing, place API under /api/

This commit is contained in:
nemunaire 2016-01-13 01:22:01 +01:00
parent e89af34c5c
commit d635420a9f
3 changed files with 29 additions and 9 deletions

View file

@ -34,7 +34,12 @@ func main() {
}
log.Println("Registering handlers...")
http.HandleFunc("/", ApiRouting)
mux := http.NewServeMux()
mux.Handle("/api/", http.StripPrefix("/api", ApiHandler()))
mux.HandleFunc("/teams", StaticRouting)
mux.HandleFunc("/themes", StaticRouting)
mux.Handle("/", http.FileServer(http.Dir("./static/")))
http.HandleFunc("/", mux.ServeHTTP)
log.Println(fmt.Sprintf("Ready, listening on %s", *bind))
if err := http.ListenAndServe(*bind, nil); err != nil {