learn-go/snippetbox/cmd/web/routes.go
2024-01-25 15:43:07 -08:00

21 lines
449 B
Go

package main
import (
"net/http"
)
// 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)
return secureHeaders(mux)
}