gemrouter

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GemConfig added in v0.0.3

type GemConfig func(router *GemRouter)

func WithAddr added in v0.0.3

func WithAddr(addr string) GemConfig

func WithHealth added in v0.0.3

func WithHealth(handler GemHandler) GemConfig

func WithMiddleware added in v0.0.3

func WithMiddleware(middleware Middleware) GemConfig

func WithMiddlewares added in v0.0.3

func WithMiddlewares(middlewares []Middleware) GemConfig

func WithNotFound added in v0.0.3

func WithNotFound(handler GemHandler) GemConfig

func WithPort added in v0.0.3

func WithPort(port string) GemConfig

type GemContext

type GemContext struct {
	Writer  http.ResponseWriter
	Request *http.Request
	Keys    map[string]any
	// contains filtered or unexported fields
}

func (*GemContext) Get

func (context *GemContext) Get(key string) (any, bool)

func (*GemContext) Header

func (context *GemContext) Header(key string) string

func (*GemContext) JSON

func (context *GemContext) JSON(data any) error

func (*GemContext) Method

func (context *GemContext) Method() string

func (*GemContext) NOTFOUND added in v0.0.3

func (context *GemContext) NOTFOUND()

func (*GemContext) NoContent

func (context *GemContext) NoContent(code int)

func (*GemContext) OK

func (context *GemContext) OK()

func (*GemContext) Param

func (context *GemContext) Param(key string) string

func (*GemContext) Path

func (context *GemContext) Path() string

func (*GemContext) Query

func (context *GemContext) Query(key string) string

func (*GemContext) Set

func (context *GemContext) Set(key string, val any)

func (*GemContext) Status

func (context *GemContext) Status(code int)

func (*GemContext) StatusCode

func (context *GemContext) StatusCode() int

func (*GemContext) String

func (context *GemContext) String(code int, text string)

func (*GemContext) ToJSON

func (context *GemContext) ToJSON(code int, data any)

type GemGroup

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

func (*GemGroup) DELETE

func (g *GemGroup) DELETE(pattern string, handler GemHandler)

func (*GemGroup) GET

func (g *GemGroup) GET(pattern string, handler GemHandler)

func (*GemGroup) PATCH

func (g *GemGroup) PATCH(pattern string, handler GemHandler)

func (*GemGroup) POST

func (g *GemGroup) POST(pattern string, handler GemHandler)

func (*GemGroup) PUT

func (g *GemGroup) PUT(pattern string, handler GemHandler)

type GemHandler

type GemHandler func(ctx *GemContext)

func Logger

func Logger(next GemHandler) GemHandler

func Recovery

func Recovery(next GemHandler) GemHandler

type GemRouter

type GemRouter struct {
	Addr        string
	Port        string
	Middlewares []Middleware
	NotFound    GemHandler
	Health      GemHandler
	// contains filtered or unexported fields
}

func CustomGemRouter

func CustomGemRouter(configs ...GemConfig) *GemRouter

func NewGemRouter

func NewGemRouter() *GemRouter

func (*GemRouter) DELETE

func (r *GemRouter) DELETE(pattern string, handler GemHandler)

func (*GemRouter) GET

func (r *GemRouter) GET(pattern string, handler GemHandler)

func (*GemRouter) Group

func (r *GemRouter) Group(prefix string, middlewares ...Middleware) *GemGroup

func (*GemRouter) NoRoute

func (r *GemRouter) NoRoute(handler GemHandler)

func (*GemRouter) PATCH

func (r *GemRouter) PATCH(pattern string, handler GemHandler)

func (*GemRouter) POST

func (r *GemRouter) POST(pattern string, handler GemHandler)

func (*GemRouter) PUT

func (r *GemRouter) PUT(pattern string, handler GemHandler)

func (*GemRouter) Run

func (r *GemRouter) Run() error

func (*GemRouter) Use

func (r *GemRouter) Use(m Middleware)

type Middleware

type Middleware func(GemHandler) GemHandler

Jump to

Keyboard shortcuts

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