httpsvr

package
v0.0.0-...-f0a4171 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateToken

func GenerateToken(claims jwt.Claims, secret []byte) (string, error)

func HttpFirstFile

func HttpFirstFile(c *gin.Context) (*multipart.FileHeader, error)

func HttpSaveFile

func HttpSaveFile(body io.ReadCloser, length int64, path string) error

func HttpSaveFirstFile

func HttpSaveFirstFile(c *gin.Context, path string) (string, error)

func ParseToken

func ParseToken(token string, secret []byte, claims jwt.Claims) error

Types

type Config

type Config struct {
	Root           string
	IndexPage      string
	HandlerUse     []HandlerFunc
	HandlerNoRoute HandlerFunc
	AuthCB         HandlerFunc
	AuthFCB        HandlerFunc
	AuthBCB        HandlerFunc
}

type Context

type Context = gin.Context

type H

type H = gin.H

type HandlerFunc

type HandlerFunc = gin.HandlerFunc

type IRoutes

type IRoutes = gin.IRoutes

type MethodFunc

type MethodFunc func(relativePath string, handlers ...HandlerFunc) IRoutes

type Server

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

func New

func New(config Config) *Server

func (*Server) Auth

func (s *Server) Auth(method MethodFunc, path string, handler ...gin.HandlerFunc)

func (*Server) AuthB

func (s *Server) AuthB(method MethodFunc, path string, handler ...gin.HandlerFunc)

func (*Server) AuthF

func (s *Server) AuthF(method MethodFunc, path string, handler ...gin.HandlerFunc)

func (*Server) Bind

func (s *Server) Bind(method MethodFunc, path string, handler ...gin.HandlerFunc)

func (*Server) DELETE

func (s *Server) DELETE(relativePath string, handlers ...HandlerFunc) IRoutes

func (*Server) GET

func (s *Server) GET(relativePath string, handlers ...HandlerFunc) IRoutes

func (*Server) POST

func (s *Server) POST(relativePath string, handlers ...HandlerFunc) IRoutes

func (*Server) PUT

func (s *Server) PUT(relativePath string, handlers ...HandlerFunc) IRoutes

func (*Server) Router

func (s *Server) Router() *gin.Engine

func (*Server) Run

func (s *Server) Run(addr string) error

Jump to

Keyboard shortcuts

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