package main import ( "fmt" "log" "net/http" ) func handler(w http.ResponseWriter, r *http.Request) { title := r.URL.Path[len("/"):] if title == "" { title = "index" } log.Print(title) http.ServeFile(w, r, "templates/" + title + ".html") } func main() { fs := http.FileServer(http.Dir("static")) http.Handle("/static/", http.StripPrefix("/static/", fs)) http.HandleFunc("/", handler) fmt.Println("Running on :8080") log.Fatal(http.ListenAndServe("0.0.0.0:8080", nil)) }