web

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: MIT Imports: 20 Imported by: 0

README

AnimeGo WEB Api接口文档

默认开启Swagger:http://localhost:7991/swagger/index.html
Swagger文档:swagger.json

鉴权

HTPP请求Header中,Access-Key为SHA256后的access_key

Swagger验证方式

通过 /sha256接口,传入配置文件中设置的 access_key,返回加密后的access_key

响应代码

code值所代码含义

200 成功
300 失败
403 鉴权失败
500 服务端未知错误

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Host string
	Port int
	WG   *sync.WaitGroup
)

Functions

func Cors

func Cors() gin.HandlerFunc

Cors 跨域中间件

func GinLogger

func GinLogger(logger *zap.SugaredLogger) gin.HandlerFunc

GinLogger 接收gin框架默认的日志

func GinRecovery

func GinRecovery(logger *zap.SugaredLogger, stack bool, response func(*gin.Context, any)) gin.HandlerFunc

GinRecovery recover掉项目可能出现的panic

func Init

func Init(opts *Options)

func InitSwagger added in v0.4.3

func InitSwagger(r *gin.Engine)

func KeyAuth

func KeyAuth() gin.HandlerFunc

KeyAuth 鉴权

func Run

func Run(ctx context.Context)

Types

type Options added in v0.6.5

type Options struct {
	*api.Options
	Host string
	Port int
	WG   *sync.WaitGroup

	Debug bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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