router

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func C

func C(h callFunc) echo.HandlerFunc

func CORS added in v0.0.3

func CORS() echo.MiddlewareFunc

func HealthCheck

func HealthCheck(c controller.Context) (err error)

func NewAuthUserMiddleware added in v0.0.3

func NewAuthUserMiddleware(userIDKey, roleIdKey, emailKey string) echo.MiddlewareFunc

func NewWrapContextMiddleware added in v0.0.3

func NewWrapContextMiddleware(logger logger.Logger) echo.MiddlewareFunc

Types

type Config

type Config interface {
	GetPort() uint
	GetCORS() bool
	GetBodyDump() bool
	GetDuration() time.Duration
	GetAuthorizationKey() string
	GetUserIDKey() string
	GetRoleIdKey() string
	GetEmailKey() string
}

type Context

type Context struct {
	echo.Context
	// contains filtered or unexported fields
}

func (Context) Authorization

func (c Context) Authorization() (claims jwt.MapClaims, err error)

func (Context) GetAuthUser added in v0.0.6

func (c Context) GetAuthUser() *controller.AuthUser

func (Context) GetLogger

func (c Context) GetLogger() logger.Logger

func (Context) ReadRequest

func (c Context) ReadRequest(request interface{}) error

func (Context) SetAuthUser

func (c Context) SetAuthUser(authUser *controller.AuthUser)

func (Context) SetContextLogger

func (c Context) SetContextLogger(log logger.Logger)

func (Context) Validate added in v0.1.1

func (c Context) Validate(request interface{}) error

type Router

type Router struct {
	Logger             logger.Logger
	Echo               *echo.Echo
	API                *echo.Group
	Port               uint
	AuthUserMiddleware echo.MiddlewareFunc
}

func NewRouter

func NewRouter(log logger.Logger, validate *validator.Validate, config Config) *Router

func (*Router) Start

func (r *Router) Start() error

Jump to

Keyboard shortcuts

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