Skip to content

Commit

Permalink
api: adds middlewares parameter to NewRouter
Browse files Browse the repository at this point in the history
  • Loading branch information
Seklfreak committed Oct 21, 2019
1 parent d152b0b commit 31da959
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ import (
)

// NewRouter creates a new HTTP Server
func NewRouter() *chi.Mux {
func NewRouter(middlewares ...func(http.Handler) http.Handler) *chi.Mux {
router := chi.NewRouter()

router.Use(middlewares...)

router.Get("/status", func(w http.ResponseWriter, _ *http.Request) {
w.Write([]byte("OK"))
})
Expand Down

0 comments on commit 31da959

Please sign in to comment.