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.

46 lines
1.0 KiB

5 years ago
5 years ago
5 years ago
  1. package main
  2. import (
  3. "fmt"
  4. "main/config"
  5. "main/init/initRouter"
  6. "main/init/qmlog"
  7. "main/init/qmsql"
  8. "main/init/registTable"
  9. "net/http"
  10. "time"
  11. )
  12. // @title Swagger Example API
  13. // @version 0.0.1
  14. // @description This is a sample Server pets
  15. // @securityDefinitions.apikey ApiKeyAuth
  16. // @in header
  17. // @name x-token
  18. // @BasePath /
  19. func main() {
  20. qmlog.InitLog()
  21. registTable.RegistTable(qmsql.InitMysql(config.Dbconfig.Admin))
  22. defer qmsql.DEFAULTDB.Close()
  23. Router := initRouter.InitRouter()
  24. //qmlog.QMLog.Info("服务器开启") // 日志测试代码
  25. s := &http.Server{
  26. Addr: ":8888",
  27. Handler: Router,
  28. ReadTimeout: 10 * time.Second,
  29. WriteTimeout: 10 * time.Second,
  30. MaxHeaderBytes: 1 << 20,
  31. }
  32. time.Sleep(10*time.Microsecond)
  33. fmt.Printf(`欢迎使用 Gin-Vue-Admin
  34. 作者奇淼 And Spike666
  35. 微信shouzi_1994
  36. 默认自动化文档地址:http://127.0.0.1%s/swagger/index.html
  37. 默认前端文件运行地址:http://127.0.0.1:8080
  38. `,s.Addr)
  39. _ = s.ListenAndServe()
  40. }
  41. func run(server *http.Server){
  42. }