func (s *Server) Router() model.Router {
	return s.MainRouter
}
Router returns server's main router.
package server
import (
	"fmt"
	"net/http"
	"os"
	"github.com/madappgang/identifo/model"
	"github.com/madappgang/identifo/web"
	"github.com/madappgang/identifo/web/middleware"
)
func NewServer(storages model.ServerStorageCollection, services model.ServerServices, restartChan chan<- bool) (model.Server, error) {
	if storages.Config == nil {
		return nil, fmt.Errorf("unable create sever with empty config storage")
	}
	settings, err := storages.Config.LoadServerSettings(false)
	if err != nil {
		return nil, err
	}
	s := Server{
		storages: storages,
		services: services,
		settings: settings,
	}
	hostName := os.Getenv("HOST_NAME")
	if len(hostName) == 0 {
		hostName = settings.General.Host
	}
	originChecker, err := middleware.NewAppOriginChecker(storages.App)
	if err != nil {
		return nil, err
	}
	routerSettings := web.RouterSetting{
		Server:           &s,
		ServeAdminPanel:  settings.AdminPanel.Enabled,
		HostName:         hostName,
		AppOriginChecker: originChecker,
		RestartChan:      restartChan,
		LoggerSettings:   settings.Logger,
	}
	r, err := web.NewRouter(routerSettings)
	if err != nil {
		return nil, err
	}
	s.MainRouter = r.(*web.Router)
	return &s, nil
}
type Server struct {
	MainRouter *web.Router
	storages   model.ServerStorageCollection
	services   model.ServerServices
	settings   model.ServerSettings
}