package main import ( "fmt" "github.com/gin-gonic/gin" "log" "lttc-go-adm-znaf/orm" "lttc-go-adm-znaf/pkg/logging" "lttc-go-adm-znaf/pkg/setting" "lttc-go-adm-znaf/routers" "net/http" ) func init() { setting.Setup() orm.Setup() logging.Setup() } // @title Golang Gin API // @version 1.0 // @description An example of gin // @termsOfService https://github.com/EDDYCJY/go-gin-example // @license.name MIT // @license.url https://github.com/EDDYCJY/go-gin-example/blob/master/LICENSE func main() { gin.SetMode(setting.ServerSetting.RunMode) routersInit := routers.InitRouter() readTimeout := setting.ServerSetting.ReadTimeout writeTimeout := setting.ServerSetting.WriteTimeout endPoint := fmt.Sprintf(":%d", setting.ServerSetting.HttpPort) maxHeaderBytes := 1 << 20 server := &http.Server{ Addr: endPoint, Handler: routersInit, ReadTimeout: readTimeout, WriteTimeout: writeTimeout, MaxHeaderBytes: maxHeaderBytes, } log.Printf("[info] start http server listening %s", endPoint) _ = server.ListenAndServe() }