package main import ( "log" "net/http" "path/filepath" "github.com/a-h/templ" "michaelthomson.dev/mthomson/go-todos-app/views" ) func main() { router := http.NewServeMux() // Serve static files router.HandleFunc("GET /assets/", func(w http.ResponseWriter, r *http.Request) { filePath := r.URL.Path[len("/assets/"):] fullPath := filepath.Join(".", "assets", filePath) http.ServeFile(w, r, fullPath) }) home := views.Home() router.Handle("GET /", templ.Handler(home)) server := http.Server{ Addr: "localhost:3000", Handler: router, } log.Fatal(server.ListenAndServe()) }