http

package
v0.7.16 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilRequestBody     = errors.New("request body cannot be nil")
	ErrInvalidRequestBody = "invalid request body type, expected: %v"
	ErrInDevelopment      = errors.New("in development")
)

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 ...ModuleWrapper) *[]ModuleWrapper

NewSubmodules is a function that creates a new submodules slice

Types

type Module added in v0.6.24

type Module struct {
	Path             string
	Service          interface{}
	Validator        interface{}
	Controller       interface{}
	LoadFn           func(m *Module)
	RegisterRoutesFn func(m *Module)
	Middlewares      *[]func(next http.Handler) http.Handler
	Submodules       *[]ModuleWrapper
	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) GetController added in v0.6.24

func (m *Module) GetController() interface{}

GetController is a function that returns the controller

func (*Module) GetPath added in v0.6.24

func (m *Module) GetPath() string

GetPath is a function that returns the path

func (*Module) GetRouter added in v0.6.24

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

GetRouter returns the router

func (*Module) GetService added in v0.6.24

func (m *Module) GetService() interface{}

GetService is a function that returns the service

func (*Module) GetValidator added in v0.6.24

func (m *Module) GetValidator() interface{}

GetValidator is a function that returns the validator

type ModuleWrapper added in v0.6.24

type ModuleWrapper interface {
	Create(baseRouter gonethttproute.RouterWrapper) error
	GetRouter() gonethttproute.RouterWrapper
	GetService() interface{}
	GetValidator() interface{}
	GetController() interface{}
	GetPath() string
	gonethttproute.RouterWrapper
}

ModuleWrapper is the interface for the route module

Directories

Path Synopsis
jwt
middleware

Jump to

Keyboard shortcuts

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