refactor: use setter for the http handler
This commit is contained in:
parent
38e330e02b
commit
3d12cff53e
|
@ -10,6 +10,7 @@ import (
|
|||
type HTTPService interface {
|
||||
Service
|
||||
GetHandler() *httprouter.Router
|
||||
SetHttpHandler(handler HTTPHandler)
|
||||
}
|
||||
|
||||
type HTTPHandler interface {
|
||||
|
|
|
@ -18,10 +18,13 @@ type HTTPImpl struct {
|
|||
handler interfaces.HTTPHandler
|
||||
}
|
||||
|
||||
func NewHTTP(node interfaces.Node, handler interfaces.HTTPHandler) interfaces.HTTPService {
|
||||
func (h *HTTPImpl) SetHttpHandler(handler interfaces.HTTPHandler) {
|
||||
h.handler = handler
|
||||
}
|
||||
|
||||
func NewHTTP(node interfaces.Node) interfaces.HTTPService {
|
||||
return &HTTPImpl{
|
||||
node: node,
|
||||
handler: handler,
|
||||
node: node,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue