package daemon import ( "fmt" "net/http" ) type Daemon struct { Host string Port int } func NewDaemon(host string, port int) *Daemon { return &Daemon{Host: host, Port: port} } func (d Daemon) GetListenAddress() string { return fmt.Sprintf("%s:%d", d.Host, d.Port) } func (d Daemon) Start() { for route, handler := range GetApiRoutes() { http.HandleFunc(route, handler) } http.ListenAndServe(d.GetListenAddress(), nil) }