Skip to content

Commit

Permalink
service: add Register method to builder
Browse files Browse the repository at this point in the history
  • Loading branch information
lithdew committed Jun 11, 2020
1 parent 6a2b7f5 commit 6396f5a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions service.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ type Service struct {
Services map[string]Handler
}

func (s *Service) Register(service string, handler Handler) {
if s.Services == nil {
s.Services = make(map[string]Handler, 1)
}
s.Services[service] = handler
}

func (s Service) Start() error {
addr := s.Addr
if addr == "" {
Expand Down

0 comments on commit 6396f5a

Please sign in to comment.