main.go 615 B

1234567891011121314151617181920212223242526272829
  1. package main
  2. import (
  3. "mop-article-pub-center/common"
  4. "mop-article-pub-center/config"
  5. "mop-article-pub-center/router"
  6. "gitlab.finogeeks.club/finclip-backend/apm"
  7. "github.com/gin-gonic/gin"
  8. "github.com/sirupsen/logrus"
  9. )
  10. func main() {
  11. gin.SetMode(config.Cfg.Mode)
  12. g := gin.Default()
  13. apm.ApmClient().InjectHttpMiddleware(g)
  14. router.Load(g)
  15. common.GLog.Info("start server...")
  16. err := g.Run(":" + config.Cfg.HttpPort)
  17. if err != nil {
  18. common.GLog.WithFields(logrus.Fields{
  19. "error": err.Error(),
  20. "start_port": config.Cfg.HttpPort,
  21. }).Error("server start error!")
  22. panic(err.Error())
  23. }
  24. }