Help us shape the future of Go! Take the 2026 Go Developer Survey

http

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// CREATED the server instance was created
	CREATED = uint8(iota)
	// STARTING the server instance is starting
	STARTING
	// READY the server instance is ready
	READY
	// RESTARTING the server instance is restarting
	RESTARTING
	// CLOSED the server instance was stopped
	CLOSED
)
View Source
const (
	// CLOSE close signal
	CLOSE = uint8(iota) + 5
	// RESTART restart signal
	RESTART
	// ERROR error signal
	ERROR
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option struct {
	Port    int           `json:"port,omitempty"`
	Host    string        `json:"host,omitempty"`
	Timeout time.Duration `json:"timeout,omitempty"`
	Root    string        `json:"root,omitempty"`   // API Root
	Allows  []string      `json:"allows,omitempty"` // CORS Domains
}

Option the http server opiton

type Server

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

Server the http server opiton

func New

func New(router *gin.Engine, option Option) *Server

New create a new http server

func (*Server) Event

func (server *Server) Event() chan uint8

Event get event signal

func (*Server) Port

func (server *Server) Port() (int, error)

Port get server port

func (*Server) Ready

func (server *Server) Ready() bool

Ready check if the status is ready

func (*Server) Reset added in v1.0.0

func (server *Server) Reset(router *gin.Engine)

Reset the http server

func (*Server) Restart

func (server *Server) Restart() error

Restart a http server

func (*Server) Start

func (server *Server) Start() error

Start a http server

func (*Server) Stop

func (server *Server) Stop() error

Stop a http server

func (*Server) With

func (server *Server) With(middlewares ...func(ctx *gin.Context)) *Server

With middlewares

Jump to

Keyboard shortcuts

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