func (s *Server) Start() error {
	go func() {
		if err := s.listener.ListenAndServe(); err != nil {
			if err.Error() != "http: Server closed" {
				logger.Log().Error(err)
			}
		}
	}()
	logger.Log().Infof("http server listening on %v", s.listener.Addr)
	return nil
}
Start starts a http server and returns immediately.
package server
import (
	"context"
	"net/http"
	"os"
	"os/signal"
	"syscall"
	"time"
	"github.com/lbryio/lbrytv/api"
	"github.com/lbryio/lbrytv/app/sdkrouter"
	"github.com/lbryio/lbrytv/internal/monitor"
	"github.com/gorilla/mux"
)
var logger = monitor.NewModuleLogger("server")
type Server struct {
	address  string
	listener *http.Server
	stopChan chan os.Signal
	stopWait time.Duration
}
func NewServer(address string, sdkRouter *sdkrouter.Router) *Server {
	r := mux.NewRouter()
	api.InstallRoutes(r, sdkRouter)
	r.Use(monitor.ErrorLoggingMiddleware)
	r.Use(defaultHeadersMiddleware(map[string]string{
		"Server":                       "api.lbry.tv",
		"Access-Control-Allow-Origin":  "*",
		"Access-Control-Allow-Headers": "content-type",  
	}))
	return &Server{
		address:  address,
		stopWait: 15 * time.Second,
		stopChan: make(chan os.Signal),
		listener: &http.Server{
			Addr:    address,
			Handler: r,
			WriteTimeout: 0,
			IdleTimeout:       0,
			ReadHeaderTimeout: 10 * time.Second,
		},
	}
}
func defaultHeadersMiddleware(defaultHeaders map[string]string) mux.MiddlewareFunc {
	return func(next http.Handler) http.Handler {
		return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
			for k, v := range defaultHeaders {
				w.Header().Set(k, v)
			}
			next.ServeHTTP(w, r)
		})
	}
}
func (s *Server) Address() string {
	return s.address
}