httpGateway

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContext

func NewContext(routeParsed RouteParsed, writer http.ResponseWriter, req *http.Request) core.HttpContext

Types

type Config

type Config struct {
	Port string
}

type Context

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

func (*Context) Abort

func (c *Context) Abort() core.HttpContext

func (*Context) Blob

func (c *Context) Blob(code int, contentType string, data []byte) core.HttpContext

func (*Context) Body

func (c *Context) Body() []byte

func (*Context) Cookie

func (c *Context) Cookie(name string) string

func (*Context) File

func (c *Context) File(code int, filepath string) core.HttpContext

func (*Context) FormFile

func (c *Context) FormFile(name string) ([]byte, error)

func (*Context) FormValue

func (c *Context) FormValue(key string) string

func (*Context) Get

func (c *Context) Get(key string) any

func (*Context) HTML

func (c *Context) HTML(code int, html string) core.HttpContext

func (*Context) Header

func (c *Context) Header(key string) string

func (*Context) IsAborted

func (c *Context) IsAborted() bool

func (*Context) JSON

func (c *Context) JSON(code int, data any) core.HttpContext

func (*Context) Method

func (c *Context) Method() string

func (*Context) MustGet

func (c *Context) MustGet(key string) any

func (*Context) Next

func (c *Context) Next() core.HttpContext

func (*Context) Param

func (c *Context) Param(key string) string

func (*Context) Path

func (c *Context) Path() string

func (*Context) Protocol

func (c *Context) Protocol() string

func (*Context) Query

func (c *Context) Query(key string) string

func (*Context) QueryDefault

func (c *Context) QueryDefault(key, def string) string

func (*Context) Set

func (c *Context) Set(key string, value any) core.HttpContext

func (*Context) SetCookie

func (c *Context) SetCookie(name, value string, options ...any) core.HttpContext

func (*Context) SetHeader

func (c *Context) SetHeader(key, value string) core.HttpContext

func (*Context) Status

func (c *Context) Status(code int) core.HttpContext

func (*Context) Text

func (c *Context) Text(code int, data string) core.HttpContext

type Gateway

type Gateway struct {
	Routes      []Route
	Middlewares []core.HttpHandler
	// contains filtered or unexported fields
}

func New

func New(config Config) *Gateway

func (*Gateway) CreateScope

func (g *Gateway) CreateScope(module *core.Module, prefix string) core.HttpScope

func (*Gateway) Start

func (g *Gateway) Start() error

func (*Gateway) Use

func (g *Gateway) Use(mw ...core.HttpHandler)

type Route

type Route struct {
	Method   string
	Pattern  string
	Handlers []core.HttpHandler
	Scope    *Scope
}

type RouteParsed

type RouteParsed struct {
	Params map[string]string
	Query  map[string]string
}

type Scope

type Scope struct {
	Gateway     *Gateway
	Middlewares []core.HttpHandler
	// contains filtered or unexported fields
}

func (*Scope) Connect

func (s *Scope) Connect(path string, handlers ...core.HttpHandler)

func (*Scope) Delete

func (s *Scope) Delete(path string, handlers ...core.HttpHandler)

func (*Scope) Get

func (s *Scope) Get(path string, handlers ...core.HttpHandler)

func (*Scope) Head

func (s *Scope) Head(path string, handlers ...core.HttpHandler)

func (*Scope) Options

func (s *Scope) Options(path string, handlers ...core.HttpHandler)

func (*Scope) Patch

func (s *Scope) Patch(path string, handlers ...core.HttpHandler)

func (*Scope) Post

func (s *Scope) Post(path string, handlers ...core.HttpHandler)

func (*Scope) Put

func (s *Scope) Put(path string, handlers ...core.HttpHandler)

func (*Scope) SetLogger

func (s *Scope) SetLogger(logger *core.Logger)

func (*Scope) Trace

func (s *Scope) Trace(path string, handlers ...core.HttpHandler)

func (*Scope) Use

func (s *Scope) Use(mw ...core.HttpHandler)

Directories

Path Synopsis
middlewares

Jump to

Keyboard shortcuts

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