Created
April 20, 2020 05:59
-
-
Save alexedwards/947195d45cc2f52e9f4b5addd9cee516 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sessionManager = scs.New() | |
sessionManager.Store = redisstore.New(pool) | |
standardMiddleware := alice.New(app.recoverPanic, app.logRequest, secureHeaders) | |
dynamicMiddleware := alice.New(sessionManager.LoadAndSave, noSurf, app.authenticate) | |
mux := pat.New() | |
mux.Get("/", dynamicMiddleware.ThenFunc(app.home)) | |
mux.Get("/about", dynamicMiddleware.ThenFunc(app.about)) | |
... | |
fileServer := http.FileServer(http.Dir("./ui/static/")) | |
mux.Get("/static/", http.StripPrefix("/static", fileServer)) | |
return standardMiddleware.Then(mux) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment