bingo-gin

module
v0.0.0-...-a4ab4b0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2021 License: MIT

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

Path Synopsis

Jump to

Keyboard shortcuts

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