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