4 Unstar Star 9 Fork 2

xxfaxy / gin_newGo

Create your Gitee Account
Explore and code with more than 5 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
基于GO GIN的MVC框架 spread retract

Clone or download
main.go 805 Bytes
Copy Edit Web IDE Raw Blame History
xxfaxy authored 2020-05-16 12:01 . init
package main
import (
"Dry/Config"
"Dry/Constant"
"Dry/Frame"
"Dry/Modules/Admin/Controller"
"Dry/Modules/Api/Controller"
"Dry/Variable"
"flag"
"github.com/gin-gonic/gin"
"log"
)
var (
env string
)
func init() {
flag.StringVar(&env, "env", Config.GetEnvList()[0], "main -env "+Config.GetEnvString("|"))
}
func AddModuleRouter(r *gin.Engine) {
ApiController.RegisterRouter()
AdminController.RegisterRouter()
Frame.RegisterRouter(r)
}
func main() {
flag.Parse()
Variable.Env = env
if env == Constant.ENV_LOCAL {
gin.SetMode(gin.DebugMode)
} else {
gin.SetMode(gin.ReleaseMode)
}
r := gin.Default()
AddModuleRouter(r)
err := r.Run(Variable.Port)
if err != nil {
log.Println(err)
}
}

Comment ( 0 )

Sign in for post a comment

Go
1
https://gitee.com/xxfaxy/gin_new.git
git@gitee.com:xxfaxy/gin_new.git
xxfaxy
gin_new
gin_new
master

Search