module
Version:
v0.0.0-...-a4ab4b0
Opens a new window with list of versions in this module.
Published: Nov 6, 2021
License: MIT
Opens a new window with license information.
README
¶
bingo-gin
基于gin框架封装的脚手架, 对原本gin框架功能进行了增强,加入了事件机制,依赖注入, responder等
##安装
go get -u github.com/hhaojin/bingo-gin
##使用
package main
import (
"github.com/hhaojin/bingo-gin/bingo"
"github.com/hhaojin/bingo-gin/example"
"github.com/hhaojin/bingo-gin/example/ctls"
"github.com/hhaojin/bingo-gin/example/models"
_ "net/http/pprof"
)
func main() {
bingo.New().
Listener(&example.EventListener{}). //全局事件
Use(bingo.RecoverHandler()). //全局中间件
Configs( //初始资源。 例如db, cache 连接池等
&models.Config{},
).
InjectCtl( //注入控制器,注册路由
&ctls.OrderCtl{},
).
Pprof(9090). //启动 pprof
Run(8080) //启动服务
}
Directories
¶
Click to show internal directories.
Click to hide internal directories.