mirror of
https://github.com/astaxie/beego.git
synced 2025-07-04 16:20:18 +00:00
add custom middleware options for beego.Run()
This commit is contained in:
14
beego.go
14
beego.go
@ -67,6 +67,20 @@ func Run(params ...string) {
|
||||
BeeApp.Run()
|
||||
}
|
||||
|
||||
func RunWithMiddleWares(addr string, mws ...MiddleWare) {
|
||||
initBeforeHTTPRun()
|
||||
|
||||
strs := strings.Split(addr, ":")
|
||||
if len(strs) > 0 && strs[0] != "" {
|
||||
BConfig.Listen.HTTPAddr = strs[0]
|
||||
}
|
||||
if len(strs) > 1 && strs[1] != "" {
|
||||
BConfig.Listen.HTTPPort, _ = strconv.Atoi(strs[1])
|
||||
}
|
||||
|
||||
BeeApp.Run(mws...)
|
||||
}
|
||||
|
||||
func initBeforeHTTPRun() {
|
||||
//init hooks
|
||||
AddAPPStartHook(
|
||||
|
Reference in New Issue
Block a user