http

package
v0.9.22 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2025 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCookieNotFound     = errors.New("cookie not found")
	ErrNilRequestBody     = errors.New("request body cannot be nil")
	ErrInvalidRequestBody = "invalid request body type, expected: %v"
	ErrInDevelopment      = errors.New("in development")
	ErrNilSubmodule       = "%s: submodule at index %d is nil"
)
View Source
var (
	ErrCodeCookieNotFound *string
)

Functions

func GetClientIP added in v0.5.8

func GetClientIP(r *http.Request) string

GetClientIP returns the client's IP address from the request

func NewMiddlewares added in v0.7.8

func NewMiddlewares(middlewares ...func(next http.Handler) http.Handler) *[]func(next http.Handler) http.Handler

NewMiddlewares is a function that creates a new middlewares slice

func NewSubmodules added in v0.6.24

func NewSubmodules(submodules ...*Module) *[]*Module

NewSubmodules is a function that creates a new submodules slice

Types

type Module added in v0.6.24

type Module struct {
	Pattern          string
	Service          interface{}
	Controller       interface{}
	BeforeLoadFn     func(m *Module)
	RegisterRoutesFn func(m *Module)
	AfterLoadFn      func(m *Module)
	Middlewares      *[]func(next http.Handler) http.Handler
	Submodules       *[]*Module
	gonethttproute.RouterWrapper
}

Module is the struct for the route module

func (*Module) Create added in v0.6.24

func (m *Module) Create(
	baseRouter gonethttproute.RouterWrapper,
) error

Create is a function that creates the router for the controller and its submodules, and loads the module

func (*Module) GetRouter added in v0.6.24

func (m *Module) GetRouter() gonethttproute.RouterWrapper

GetRouter returns the router

Directories

Path Synopsis
middleware

Jump to

Keyboard shortcuts

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