rest

package
v0.1.73 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

middleware aop

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHttpServer

func NewHttpServer(opts ...HttpServerOption) *httpServer

Types

type Context

type Context struct {
	Req    *http.Request
	Resp   http.ResponseWriter
	Params map[string]string

	RespData       []byte
	RespStatusCode int

	MatchedRoute string
}

func (*Context) Bind added in v0.1.51

func (c *Context) Bind(data any) error

func (*Context) Query added in v0.1.51

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

func (*Context) Redirect added in v0.1.51

func (c *Context) Redirect(url string)

func (*Context) Render added in v0.1.51

func (c *Context) Render(ts *template.Template, name string, data any)

func (*Context) RespString added in v0.1.51

func (c *Context) RespString(msg string, statusCode int)

type HandleFunc

type HandleFunc func(ctx *Context)

type HttpServerOption added in v0.1.21

type HttpServerOption func(s *httpServer)

func ServerWithMiddleware added in v0.1.21

func ServerWithMiddleware(ms ...MiddleWare) HttpServerOption

type MiddleWare added in v0.1.21

type MiddleWare func(next HandleFunc) HandleFunc

type Server

type Server interface {
	http.Handler
	Start(addr string) error
	// contains filtered or unexported methods
}

Directories

Path Synopsis
middleware

Jump to

Keyboard shortcuts

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