cmd/server/main.go (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
package main
import (
"fmt"
"log"
"net/http"
)
func main() {
fs := http.FileServer(http.Dir("static"))
http.Handle("/static/", http.StripPrefix("/static/", fs))
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "templates/index.html")
})
http.HandleFunc("/music", func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "templates/music.html")
})
fmt.Println("Running on :8080")
log.Fatal(http.ListenAndServe("0.0.0.0:8080", nil))
}
|