http

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context interface {
	JSON(code int, obj any)
	Bind(obj any) error
	Param(key string) string
	Query(key string) string
	QueryParams() map[string][]string
	BindJSON(obj any) error
	SetHeader(key, value string)
	Method() string
	Path() string
	SetStatus(code int)
	Status() int
	RemoteIP() string
	Header(header string) string
	Body(string)

	Abort()
	Next()

	Set(key string, value any)
	Get(key string) any

	Request() *http.Request
}

type HTTPEngine

type HTTPEngine interface {
	Init(port int) error
	RegisterRoute(method string, path string, handler HandlerFunc, entity any, isProtected bool)
	Use(middleware MiddlewareFunc)
	Start() error
	Routes() []Route
}

type HandlerFunc

type HandlerFunc func(ctx Context)

type MiddlewareFunc

type MiddlewareFunc func(next HandlerFunc) HandlerFunc

type Route added in v1.2.0

type Route struct {
	Method    string
	Path      string
	Entity    any
	Protected bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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