web

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2025 License: MIT Imports: 26 Imported by: 25

Documentation

Index

Constants

View Source
const MODULE = "web"

Variables

View Source
var Engine *gin.Engine
View Source
var JwtExpire = time.Hour * 24 * 30
View Source
var JwtKey = "boat"
View Source
var Server *http.Server

Functions

func JwtGenerate

func JwtGenerate(id string, admin bool) (string, error)

func OpenStaticFile added in v0.0.2

func OpenStaticFile(name string) (file http.File, err error)

func Serve

func Serve() error

func ServeAutoCert added in v0.0.4

func ServeAutoCert() error

func ServeHTTP

func ServeHTTP() error

func ServeTLS

func ServeTLS() error

func ServeUnix added in v0.0.4

func ServeUnix() error

func Shutdown

func Shutdown() error

func Startup

func Startup() error

func Static

func Static(fs http.FileSystem, path, base, index string)

Static 静态目录 path url路径。 base 基本路径(主要用于zip文件)。 index 默认首页,index.html 代表SPA应用。

func StaticDir added in v0.0.2

func StaticDir(dir string, path, base, index string)

func StaticEmbedFS added in v0.0.2

func StaticEmbedFS(fs embed.FS, path, base, index string)

func StaticFS added in v0.0.2

func StaticFS(fs fs.FS, path, base, index string)

func StaticZip added in v0.0.2

func StaticZip(zip string, path, base, index string)

Types

type Claims

type Claims struct {
	jwt.RegisteredClaims
	Admin bool `json:"admin,omitempty"`
}

func JwtVerify

func JwtVerify(str string) (*Claims, error)

Jump to

Keyboard shortcuts

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