package main import ( "net/http" "github.com/justinas/alice" ) // routes ... func (app *application) routes() http.Handler { mux := http.NewServeMux() // setup server for static files fileServer := http.FileServer(http.Dir("./ui/static")) mux.Handle("/static/", http.StripPrefix("/static", fileServer)) mux.HandleFunc("/", app.home) mux.HandleFunc("/snippet/view", app.snippetView) mux.HandleFunc("/snippet/create", app.snippetCreate) standard := alice.New(app.recoverPanic, app.logRequest, secureHeaders) return standard.Then(mux) }