ch17
This commit is contained in:
@@ -24,6 +24,7 @@ func (app *application) routes() http.Handler {
|
||||
dynamic := alice.New(app.sessionManager.LoadAndSave, noSurf, app.authenticate)
|
||||
|
||||
router.Handler(http.MethodGet, "/", dynamic.ThenFunc(app.home))
|
||||
router.Handler(http.MethodGet, "/about", dynamic.ThenFunc(app.about))
|
||||
router.Handler(http.MethodGet, "/snippet/view/:id", dynamic.ThenFunc(app.snippetView))
|
||||
|
||||
router.Handler(http.MethodGet, "/user/signup", dynamic.ThenFunc(app.userSignup))
|
||||
@@ -33,6 +34,9 @@ func (app *application) routes() http.Handler {
|
||||
|
||||
protected := dynamic.Append(app.requireAuthentication)
|
||||
|
||||
router.Handler(http.MethodGet, "/account/view", protected.ThenFunc(app.accountView))
|
||||
router.Handler(http.MethodGet, "/account/password", protected.ThenFunc(app.accountChangePassword))
|
||||
router.Handler(http.MethodPost, "/account/password", protected.ThenFunc(app.accountChangePasswordPost))
|
||||
router.Handler(http.MethodGet, "/snippet/create", protected.ThenFunc(app.snippetCreate))
|
||||
router.Handler(http.MethodPost, "/snippet/create", protected.ThenFunc(app.snippetCreatePost))
|
||||
router.Handler(http.MethodPost, "/user/logout", protected.ThenFunc(app.userLogoutPost))
|
||||
|
||||
Reference in New Issue
Block a user