-
Notifications
You must be signed in to change notification settings - Fork 948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: make route code much more siplified #988
refactor: make route code much more siplified #988
Conversation
hi, @allencloud Looking forward to your reply. |
d671e4b
to
7680500
Compare
7680500
to
6865369
Compare
6865369
to
418e4b5
Compare
418e4b5
to
7ff0583
Compare
7ff0583
to
329881d
Compare
Signed-off-by: Allen Sun <allensun.shl@alibaba-inc.com>
329881d
to
ad5cd31
Compare
Can we ensure that In addition, I think |
Codecov Report
@@ Coverage Diff @@
## master #988 +/- ##
=======================================
Coverage 13.72% 13.72%
=======================================
Files 124 124
Lines 8367 8367
=======================================
Hits 1148 1148
Misses 7120 7120
Partials 99 99 Continue to review full report at Codecov.
|
LGTM |
Signed-off-by: Allen Sun allensun.shl@alibaba-inc.com
Ⅰ. Describe what this PR did
I think without this PR, code adding routes to pouch server is very messy.
This PR makes the routed adding much more simplified.
Typically, I change
r.Path(versionMatcher + "/containers/{name:.*}").Methods(http.MethodDelete).Handler(s.filter(s.removeContainers))
intoaddRoute(r, http.MethodDelete, "/containers/{name:.*}", s.removeContainers)
.And add a function which is named
addRoute
.In code change
func (s *Server) filter(handler handler) http.HandlerFunc {
, I think there is no need to add(s *Server)
.Ⅱ. Does this pull request fix one issue?
none
Ⅲ. Describe how you did it
none
Ⅳ. Describe how to verify it
none
Ⅴ. Special notes for reviews