google / gnostic-go-generator

A gnostic plugin that generates Go clients and servers for REST APIs
Apache License 2.0
48 stars 19 forks source link

Expose mux router on initialize #38

Open ramarahmanda opened 2 years ago

ramarahmanda commented 2 years ago

Description

Exposing mux router so that wen can extend middleware in server

Sample usage

middleware := func(h http.Handler) http.Handler {
    return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
        log.Println("middleware", r.URL)
        h.ServeHTTP(w, r)
    })
}
r := bookstore.Initialize(NewService())
r.Use(middleware)