Files
snippetbox/cmd/web/routes.go
lbenedar 7ab49c9fc8 ch6.5
2026-03-05 13:24:54 +03:00

23 lines
505 B
Go

package main
import (
"net/http"
"github.com/justinas/alice"
)
func (app *application) routes() http.Handler {
mux := http.NewServeMux()
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)
}