server

package
v3.0.7 Latest Latest
Warning

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

Go to latest
Published: May 14, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Application = "application"
	Port        = "port"
	Timeout     = "timeout"
	Read        = "read"
	Write       = "write"
	Mode        = "mode"
	Enable      = "enable"
	Version     = "version"
	Key         = "key"
	Value       = "value"
	AppId       = "appId"
	BaseRoute   = "apiBaseRoute"
	UploadPath  = "uploadPath"
)
View Source
const (
	I18n            = "i18n"
	DefaultLanguage = "defaultLanguage"
	File            = "file"
	Path            = "Path"
	Type            = "type"
)
View Source
const (
	Default_       = "default"
	Cors           = "cors"
	AllowAllOrigin = "allowAllOrigin"
	AllowOrigins   = "allowOrigins"
	AllowHeaders   = "allowHeaders"
	AllowMethods   = "allowMethods"
)
View Source
const (
	LOG      = "log"
	Format   = "format"
	Level    = "level"
	MaxAge   = "maxAge"
	Filename = "filename"
)
View Source
const TimeFormat = "2006/05/26:15:04:05 +0800"

Variables

This section is empty.

Functions

func DefaultConfig

func DefaultConfig() *viper.Viper

Types

type Http

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

func NewHttp

func NewHttp(n string) *Http

func (*Http) GetGateway

func (h *Http) GetGateway() *Server

func (*Http) GetI18n

func (h *Http) GetI18n() *i18n.I18nMessageHandler

func (*Http) SetGateway

func (h *Http) SetGateway(s *Server)

func (*Http) SetI18n

func (h *Http) SetI18n(n string)

func (*Http) Setup

func (h *Http) Setup()

type HttpModule

type HttpModule interface {
	SetI18n(moduleName string)
	GetI18n() *i18n.I18nMessageHandler
	SetGateway(s *Server)
	GetGateway() *Server
	Setup()
}

type Server

type Server struct {
	// contains filtered or unexported fields
}
var (
	Gateway *Server
)

func Default

func Default() *Server

func New

func New(engine *gin.Engine, config *viper.Viper) *Server

func (*Server) AddModule

func (s *Server) AddModule(modules ...HttpModule) error

func (*Server) GetApiRoute

func (s *Server) GetApiRoute() *gin.RouterGroup

func (*Server) GetAppID

func (s *Server) GetAppID() string

func (*Server) GetConfig

func (s *Server) GetConfig() *viper.Viper

func (*Server) GetEngine

func (s *Server) GetEngine() *gin.Engine

func (*Server) GetServer

func (s *Server) GetServer() *http.Server

func (*Server) Run

func (s *Server) Run()

Run 運行 Server

func (*Server) Stop

func (s *Server) Stop()

Stop 停止 Server

func (*Server) Use

func (s *Server) Use(handle ...middleware.Object) *gin.Engine

Jump to

Keyboard shortcuts

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