This commit is contained in:
lbenedar
2026-03-05 13:24:54 +03:00
parent be06d0a5ca
commit 7ab49c9fc8
3 changed files with 11 additions and 2 deletions

View File

@@ -1,6 +1,10 @@
package main package main
import "net/http" import (
"net/http"
"github.com/justinas/alice"
)
func (app *application) routes() http.Handler { func (app *application) routes() http.Handler {
mux := http.NewServeMux() mux := http.NewServeMux()
@@ -12,5 +16,7 @@ func (app *application) routes() http.Handler {
mux.HandleFunc("/snippet/view", app.snippetView) mux.HandleFunc("/snippet/view", app.snippetView)
mux.HandleFunc("/snippet/create", app.snippetCreate) mux.HandleFunc("/snippet/create", app.snippetCreate)
return app.recoverPanic(app.logRequest(secureHeaders(mux))) standard := alice.New(app.recoverPanic, app.logRequest, secureHeaders)
return standard.Then(mux)
} }

1
go.mod
View File

@@ -5,4 +5,5 @@ go 1.25.0
require ( require (
filippo.io/edwards25519 v1.1.0 // indirect filippo.io/edwards25519 v1.1.0 // indirect
github.com/go-sql-driver/mysql v1.9.3 // indirect github.com/go-sql-driver/mysql v1.9.3 // indirect
github.com/justinas/alice v1.2.0 // indirect
) )

2
go.sum
View File

@@ -2,3 +2,5 @@ filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
github.com/go-sql-driver/mysql v1.9.3 h1:U/N249h2WzJ3Ukj8SowVFjdtZKfu9vlLZxjPXV1aweo= github.com/go-sql-driver/mysql v1.9.3 h1:U/N249h2WzJ3Ukj8SowVFjdtZKfu9vlLZxjPXV1aweo=
github.com/go-sql-driver/mysql v1.9.3/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU= github.com/go-sql-driver/mysql v1.9.3/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU=
github.com/justinas/alice v1.2.0 h1:+MHSA/vccVCF4Uq37S42jwlkvI2Xzl7zTPCN5BnZNVo=
github.com/justinas/alice v1.2.0/go.mod h1:fN5HRH/reO/zrUflLfTN43t3vXvKzvZIENsNEe7i7qA=