You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
753 B

5 years ago
5 years ago
5 years ago
  1. package main
  2. import (
  3. "main/config"
  4. "main/init/initRouter"
  5. "main/init/qmlog"
  6. "main/init/qmsql"
  7. "main/init/registTable"
  8. "net/http"
  9. "time"
  10. )
  11. // @title Swagger Example API
  12. // @version 0.0.1
  13. // @description This is a sample Server pets
  14. // @securityDefinitions.apikey ApiKeyAuth
  15. // @in header
  16. // @name x-token
  17. // @BasePath /
  18. func main() {
  19. qmlog.InitLog()
  20. registTable.RegistTable(qmsql.InitMysql(config.Dbconfig.Admin))
  21. defer qmsql.DEFAULTDB.Close()
  22. Router := initRouter.InitRouter()
  23. //qmlog.QMLog.Info("服务器开启") // 日志测试代码
  24. s := &http.Server{
  25. Addr: ":8888",
  26. Handler: Router,
  27. ReadTimeout: 10 * time.Second,
  28. WriteTimeout: 10 * time.Second,
  29. MaxHeaderBytes: 1 << 20,
  30. }
  31. _ = s.ListenAndServe()
  32. }