refactor: use setter for the http handler

This commit is contained in:
Derrick Hammer 2024-01-14 22:06:18 -05:00
parent 38e330e02b
commit 3d12cff53e
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
2 changed files with 7 additions and 3 deletions

View File

@ -10,6 +10,7 @@ import (
type HTTPService interface {
Service
GetHandler() *httprouter.Router
SetHttpHandler(handler HTTPHandler)
}
type HTTPHandler interface {

View File

@ -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,
}
}