Add AddRequiredRoutes method to Router
This commit is contained in:
parent
834de42a3f
commit
63f669f03f
@ -24,10 +24,17 @@ func NewRouter(mux *http.ServeMux, requiredRoutes []string) (ro *Router) {
|
||||
ServeMux: mux,
|
||||
routes: make(map[Route]*server),
|
||||
}
|
||||
ro.AddRequiredRoutes(requiredRoutes)
|
||||
return
|
||||
}
|
||||
|
||||
func (ro *Router) AddRequiredRoutes(requiredRoutes []string) {
|
||||
if requiredRoutes == nil {
|
||||
return
|
||||
}
|
||||
for _, pattern := range requiredRoutes {
|
||||
ro.routes[Route{pattern: pattern, required: true}] = &server{}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (ro *Router) Register(pattern string, server *server) (err error) {
|
||||
|
Loading…
Reference in New Issue
Block a user