httpserver

package
v0.5.8 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JwtInfo

type JwtInfo struct {
	// defaults to "JWT"
	Realm string
	// defaults to empty
	Key string
	// defaults to 7 days
	Timeout time.Duration
	// defaults to 7 days
	MaxRefresh time.Duration
}

type Server

type Server struct {
	*gin.Engine
	// contains filtered or unexported fields
}

Server wrapper for gin.Engine

func NewServer

func NewServer(opts ...ServerOption) *Server

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

start rest server

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

func (*Server) Translator

func (s *Server) Translator() ut.Translator

type ServerOption

type ServerOption func(*Server)

func WithEnableProfiling

func WithEnableProfiling(profiling bool) ServerOption

func WithHealthz

func WithHealthz(healthz bool) ServerOption

func WithJwt

func WithJwt(jwt *JwtInfo) ServerOption

func WithMetrics

func WithMetrics(enable bool) ServerOption

func WithMiddlewares

func WithMiddlewares(middlewares []string) ServerOption

func WithMode

func WithMode(mode string) ServerOption

func WithPort

func WithPort(port int) ServerOption

func WithServiceName

func WithServiceName(srvName string) ServerOption

func WithTransNames

func WithTransNames(transName string) ServerOption

Directories

Path Synopsis
auth
Package auth defines authentication strategy like Basic, Bearer.
Package auth defines authentication strategy like Basic, Bearer.

Jump to

Keyboard shortcuts

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