Add caching middlware for static files
This commit is contained in:
@ -19,7 +19,9 @@ type application struct {
|
||||
func (app *application) routes() http.Handler {
|
||||
mux := http.NewServeMux()
|
||||
|
||||
mux.Handle("GET /static/", http.FileServerFS(ui.Files))
|
||||
cached := alice.New(app.cacheStatic)
|
||||
mux.Handle("GET /static/", cached.Then(http.FileServerFS(ui.Files)))
|
||||
|
||||
mux.HandleFunc("GET /election/create", app.createElectionPage)
|
||||
|
||||
api.HandlerWithOptions(app, api.StdHTTPServerOptions{
|
||||
|
Reference in New Issue
Block a user