http

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HttpController

type HttpController struct {
}

func (*HttpController) Fail

func (hc *HttpController) Fail(ctx *routing.Context, err error, msg ...string) error

func (*HttpController) ReadJson

func (hc *HttpController) ReadJson(ctx *routing.Context, data interface{}) error

func (*HttpController) ReadParams

func (hc *HttpController) ReadParams() error

func (*HttpController) Success

func (hc *HttpController) Success(ctx *routing.Context, data interface{}, msg string) error

type HttpServer

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

func New

func New(port int32) *HttpServer

func (*HttpServer) Port

func (hs *HttpServer) Port() int32

func (*HttpServer) RegisterRoute

func (hs *HttpServer) RegisterRoute(prefix string, routes []Route, middlewares ...routing.Handler)

func (*HttpServer) Router

func (hs *HttpServer) Router() *routing.RouteGroup

func (*HttpServer) Server

func (hs *HttpServer) Server()

type MethodType

type MethodType string
const (
	GET    MethodType = "GET"
	POST   MethodType = "POST"
	PUT    MethodType = "PUT"
	DELETE MethodType = "DELETE"
)

type Response

type Response struct {
	Code      int32       `json:"code"`
	Msg       string      `json:"msg"`
	Data      interface{} `json:"data"`
	RequestId interface{} `json:"requestId"`
}

type Route

type Route struct {
	Path    string
	Method  MethodType
	Handler func(ctx *routing.Context) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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