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.

32 lines
711 B

  1. package main
  2. import (
  3. "main/config"
  4. "main/init"
  5. "net/http"
  6. "time"
  7. )
  8. // @Summary 打印测试功能
  9. // @title Swagger Example API
  10. // @version 0.0.1
  11. // @description This is a sample server Petstore server.
  12. // @BasePath /api/v1
  13. // @Host 127.0.0.1:8080
  14. // @Produce json
  15. // @Param name query string true "Name"
  16. // @Success 200 {string} json "{"code":200,"data":"name","msg":"ok"}"
  17. // @Router / [get]
  18. func main() {
  19. init.InitMysql(config.Dbconfig.Admin)
  20. defer init.DEFAULTDB.Close()
  21. init.InitRouter()
  22. s := &http.Server{
  23. Addr: ":8888",
  24. Handler: init.Router,
  25. ReadTimeout: 10 * time.Second,
  26. WriteTimeout: 10 * time.Second,
  27. MaxHeaderBytes: 1 << 20,
  28. }
  29. _ = s.ListenAndServe()
  30. }