From 6396f5a2377b8295106233e2f918156c80c4d3bf Mon Sep 17 00:00:00 2001 From: Kenta Iwasaki Date: Thu, 11 Jun 2020 21:51:23 +0900 Subject: [PATCH] service: add Register method to builder --- service.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/service.go b/service.go index bfeebdd..c7f29d8 100644 --- a/service.go +++ b/service.go @@ -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 == "" {