http

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: GPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// PathPatternKey HTTP path pattern key
	PathPatternKey = "pattern"
)

Variables

This section is empty.

Functions

func AddMiddleWares

func AddMiddleWares(e *gin.Engine, middlewares ...gin.HandlerFunc)

func DefaultEngine

func DefaultEngine() *gin.Engine

func NewEngine

func NewEngine(middlewares ...gin.HandlerFunc) *gin.Engine

Types

type Router

type Router interface {
	gin.IRouter
	RegisterServiceHandler(handler ServiceHandler)
}

Router http router

type Server

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

Server http server

func DefaultServer

func DefaultServer(opts ...ServerOption) *Server

DefaultServer 默认的http server入口

func NewServer

func NewServer(opts ...ServerOption) *Server

NewServer new server with options

func (*Server) GetListener

func (s *Server) GetListener() net.Listener

GetListener get servers listener

func (*Server) RegisterServiceHandler

func (s *Server) RegisterServiceHandler(handler ServiceHandler)

RegisterServiceHandler register gRpc-gateway handler

func (*Server) Start

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

Start start http server

func (*Server) Stop

func (s *Server) Stop() error

Stop stop http server

type ServerOption

type ServerOption func(*Server)

ServerOption options for http server

func Address

func Address(address string) ServerOption

Address listen address

func GRpcServerAddress

func GRpcServerAddress(address string) ServerOption

GRpcServerAddress gRpc server address for gRpc-Gateway

func Listener

func Listener(lis net.Listener) ServerOption

Listener listener

type ServiceHandler

type ServiceHandler func(context.Context, *runtime.ServeMux, *grpc.ClientConn) error

ServiceHandler gRpc-Gateway handler

Jump to

Keyboard shortcuts

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