diff options
Diffstat (limited to 'server.go')
-rw-r--r-- | server.go | 23 |
1 files changed, 13 insertions, 10 deletions
@@ -19,21 +19,24 @@ var static embed.FS func NewServer(addr string, db *model.DB) *Server { mux := http.NewServeMux() - mux.Handle("GET /static/", http.StripPrefix("/static/", http.FileServer(http.FS(static)))) + mux.Handle( + "GET /static/", + http.StripPrefix("/static/", http.FileServer(http.FS(static))), + ) - mux.HandleFunc("GET /version", view.VersionRead(version)) + mux.Handle("GET /version", view.VersionRead(version)) - mux.HandleFunc("GET /recipes", view.RecipesRead(db)) + mux.Handle("GET /recipes", view.RecipesRead(db)) - mux.HandleFunc("GET /recipe/create", view.RecipeCreate) - mux.HandleFunc("POST /recipe", controller.RecipeCreate(db)) - mux.HandleFunc("GET /recipe/{id}", view.RecipeRead(db)) - mux.HandleFunc("POST /recipe/{id}", controller.RecipeUpdate(db)) - mux.HandleFunc("DELETE /recipe/{id}", controller.RecipeDelete(db)) + mux.Handle("GET /recipe/create", view.RecipeCreate()) + mux.Handle("POST /recipe", controller.RecipeCreate(db)) + mux.Handle("GET /recipe/{id}", view.RecipeRead(db)) + mux.Handle("POST /recipe/{id}", controller.RecipeUpdate(db)) + mux.Handle("DELETE /recipe/{id}", controller.RecipeDelete(db)) - mux.HandleFunc("GET /favicon.ico", view.FaviconRead) + mux.Handle("GET /favicon.ico", view.FaviconRead()) - mux.HandleFunc("GET /", view.IndexRead) + mux.Handle("GET /", view.IndexRead()) var srv http.Server srv.Addr = addr |