webRouter

package
v0.0.0-...-126e10b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2024 License: MIT Imports: 8 Imported by: 0

README

Web Router Service

The purpose of this Service Mesh service is to provide a way for other services to expose web routes on a locally hosted web server.

At the time of writing, many of the exposed routes are used for debugging purposes like extracting files from the MPQ's or yielding the marshalled records in json format.

Dependencies

This service has a single dependency on the config manager service

It should be noted that while this service may operate without the web server service, it is only used by said service. The absence of the web server renders this service inert.

Integration with other services

This service exports an integration interface IsWebRouter with an alias Dependencncy which are intended to be used by other services for dependency resolution (see servicemesh.HasDependencies), and expose just the methods which other services should use.

type Dependency = IsWebRouter

// IsWebRouter is just responsible for yielding the root route handler.
// Services will use this in order to set up their own routes.
type IsWebRouter interface {
    RouteRoot() *gin.Engine
    Reload()
}

Other services should use the IsWebRouter or Dependency interfaces to resolve their dependency on this service.


The following interfaces can be optionally implemented by other servicemesh services to expose web routes on the locally hosted web server.

// HasRouteSlug describes a service that has an identifier that is used
// as a prefix for its subroutes
type HasRouteSlug interface {
    Slug() string
}
// IsRouteInitializer is a type of service that will
// set up its own web routes using a base route group
type IsRouteInitializer interface {
    servicemesh.Service
    InitRoutes(*gin.RouterGroup)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dependency

type Dependency = IsWebRouter

type HasRouteSlug

type HasRouteSlug interface {
	Slug() string
}

HasRouteSlug describes a service that has an identifier that is used as a prefix for its subroutes

type IsRouteInitializer

type IsRouteInitializer interface {
	servicemesh.Service
	InitRoutes(*gin.RouterGroup)
}

IsRouteInitializer is a type of service that will set up its own web routes using a base route group

type IsWebRouter

type IsWebRouter interface {
	RouteRoot() *gin.Engine
	Reload()
}

IsWebRouter is just responsible for yielding the root route handler. Services will use this in order to set up their own routes.

type Service

type Service struct {
	// contains filtered or unexported fields
}

func (*Service) ConfigFileName

func (s *Service) ConfigFileName() string

func (*Service) DefaultConfig

func (s *Service) DefaultConfig() (cfg configFile.Config)

func (*Service) Init

func (s *Service) Init(mesh servicemesh.Mesh)

func (*Service) LoadConfig

func (s *Service) LoadConfig(config *configFile.Config)

func (*Service) Logger

func (s *Service) Logger() *slog.Logger

func (*Service) Name

func (s *Service) Name() string

func (*Service) Ready

func (s *Service) Ready() bool

func (*Service) Reload

func (s *Service) Reload()

func (*Service) RouteRoot

func (s *Service) RouteRoot() *gin.Engine

func (*Service) SetLogger

func (s *Service) SetLogger(l *slog.Logger)

Directories

Path Synopsis
middleware

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL