示例#1
0
func main() {
	r.SetVerbose(true)

	defer utils.Recover()
	utils.ListenSignals()
	utils.Liveness()

	if os.Getenv("DEBUG_N") != "true" {
		gin.SetMode(gin.ReleaseMode)
	}

	engine := gin.New()

	engine.Use(gin.Recovery())
	engine.Use(func() gin.HandlerFunc {
		return func(c *gin.Context) {
			defer c.Next()
			log.Info(c.Request.Method, c.Request.URL.Path, c.Writer.Status())
		}
	}())

	api.Initialize(engine)

	engine.Run(config.Get(config.KEY_API_PORT))
}
示例#2
0
func main() {
	r.SetVerbose(true)

	defer utils.Recover()
	utils.ListenSignals()
	utils.Liveness()

	err := server.Initialize()
	if err != nil {
		panic(err)
	}

	log.Info("Realtime service listening")
	log.Error(http.ListenAndServe(config.Get(config.KEY_REALTIME_PORT), nil))
}