forked from loafle/openapi-generator-original
[Go][Server] minor enhancement to the template (#4417)
* minor enhancement to the go server template * update samples
This commit is contained in:
parent
777e39007a
commit
db729be7df
@ -8,8 +8,8 @@ import (
|
||||
"os"
|
||||
"strconv"
|
||||
{{#featureCORS}}
|
||||
|
||||
"github.com/gorilla/handlers"{{/featureCORS}}
|
||||
"github.com/gorilla/handlers"
|
||||
{{/featureCORS}}
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
@ -36,8 +36,10 @@ func NewRouter(routers ...Router) *mux.Router {
|
||||
for _, route := range api.Routes() {
|
||||
var handler http.Handler
|
||||
handler = route.HandlerFunc
|
||||
handler = Logger(handler, route.Name){{#featureCORS}}
|
||||
handler = handlers.CORS()(handler){{/featureCORS}}
|
||||
handler = Logger(handler, route.Name)
|
||||
{{#featureCORS}}
|
||||
handler = handlers.CORS()(handler)
|
||||
{{/featureCORS}}
|
||||
|
||||
router.
|
||||
Methods(route.Method).
|
||||
|
@ -15,7 +15,6 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user