microservice

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2025 License: Unlicense Imports: 12 Imported by: 0

README

go-microservice

This is a simple go microservice lib

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAlive

func IsAlive(c echo.Context) error

Types

type Service

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

func New

func New() *Service

New creates a new instance of a Service with a logger the minimal required middlewares(Recover, Logger) and with the routes with the handlers IsAlive(/healthz/alive) and Prometheus (/metrics)

func (*Service) GetLogger

func (svc *Service) GetLogger() *zap.Logger

func (*Service) GetServer

func (svc *Service) GetServer() *echo.Echo

func (*Service) Run

func (svc *Service) Run(port string, terminateCallback func(context.Context) error)

Run creates a new go routine that will start the server execution. It only requires the server port and a terminateCallback function that will be executed when the service starts the shutdown routine and it should handle things like stop receiving new events, or disconnect database connections, or flushing pre allocated memory.

Jump to

Keyboard shortcuts

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