lets-go:6.5 alice
This commit is contained in:
parent
2b57596bbc
commit
d6d629884b
@ -2,6 +2,8 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/justinas/alice"
|
||||||
)
|
)
|
||||||
|
|
||||||
// routes ...
|
// routes ...
|
||||||
@ -16,5 +18,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)
|
||||||
}
|
}
|
||||||
|
@ -2,4 +2,7 @@ module snippetbox.chaosfem.tw
|
|||||||
|
|
||||||
go 1.21.4
|
go 1.21.4
|
||||||
|
|
||||||
require github.com/go-sql-driver/mysql v1.7.1 // indirect
|
require (
|
||||||
|
github.com/go-sql-driver/mysql v1.7.1 // indirect
|
||||||
|
github.com/justinas/alice v1.2.0 // indirect
|
||||||
|
)
|
||||||
|
@ -1,2 +1,4 @@
|
|||||||
github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI=
|
github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI=
|
||||||
github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
|
github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
|
||||||
|
github.com/justinas/alice v1.2.0 h1:+MHSA/vccVCF4Uq37S42jwlkvI2Xzl7zTPCN5BnZNVo=
|
||||||
|
github.com/justinas/alice v1.2.0/go.mod h1:fN5HRH/reO/zrUflLfTN43t3vXvKzvZIENsNEe7i7qA=
|
||||||
|
Loading…
Reference in New Issue
Block a user