http

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTPCmd

func NewHTTPCmd(getServer InitializeServerFunc) *cobra.Command

NewHTTPCmd Get a cobra command start http server

Types

type InitializeServerFunc

type InitializeServerFunc func() (ServerInterface, error)

InitializeServerFunc function init http Server gives the posibility for dependence inject

type Server

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

Server Http server implement ServerInterface

func NewServer

func NewServer(env xin.Envirment, config ServerConfig, service Service) *Server

NewServer Create a new HTTP server

func (*Server) GetHTTPServer

func (s *Server) GetHTTPServer() (*http.Server, error)

GetHTTPServer ServerInterface implement

type ServerConfig

type ServerConfig interface {
	HTTPListen() string
}

ServerConfig config provide HTTP server setting

type ServerInterface

type ServerInterface interface {
	// provide the http server service
	GetHTTPServer() (*http.Server, error)
}

ServerInterface a server can provide http server

type Service

type Service interface {
	// register route and middleware into gin engine
	RegisterRouter(*gin.Engine) error
}

Service http service interface

Directories

Path Synopsis
api
Package api 提供api 相关的一些定义和工具函数
Package api 提供api 相关的一些定义和工具函数
middleware
Package middleware 自定义 api 中间键包,提供常用业务场景中会使用到的一些中间键封装 某些自定义功能可能会需要几个中间键组合在一起才能生效
Package middleware 自定义 api 中间键包,提供常用业务场景中会使用到的一些中间键封装 某些自定义功能可能会需要几个中间键组合在一起才能生效

Jump to

Keyboard shortcuts

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