route.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright 2019 github.com. All rights reserved.
  2. // Use of this source code is governed by github.com.
  3. package route
  4. import (
  5. "net/http"
  6. "github.com/gin-gonic/gin"
  7. "xingjia-official-gateway/controller/v1"
  8. _ "xingjia-official-gateway/docs"
  9. )
  10. func SetupRoute(engine *gin.Engine) {
  11. // 404页面
  12. engine.NoRoute(func(c *gin.Context) {
  13. c.String(http.StatusNotFound, "Not Found")
  14. })
  15. // 服务健康检查
  16. engine.GET("/ping", func(c *gin.Context) {
  17. // TODO 心跳检查
  18. c.String(http.StatusOK, "pong")
  19. })
  20. //engine.Use(middleware.Session("smart-site-supplier"))
  21. // version 1
  22. apiv1 := engine.Group("/api/v1")
  23. {
  24. c := v1.NewController()
  25. //engine.POST("/api/v1/user/login", c.Login)
  26. //apiv1.Use(middleware.Jwt())
  27. //apiv1.POST("/file", c.Upload)
  28. apiv1.GET("/file", c.DownLoad)
  29. //apiv1.PUT("/token_refresh", c.TokenRefresh)
  30. jt := apiv1.Group("/jt")
  31. {
  32. jt.GET("/desc", c.JtDescInfo)
  33. jt.GET("/vision", c.JtVisionInfo)
  34. jt.GET("/news", c.JtNewsList)
  35. jt.GET("/announcement", c.JtAnnouncementList)
  36. jt.GET("/program", c.JtProgramList)
  37. jt.GET("/lx", c.JtLxList)
  38. jt.GET("/hw", c.JtHwList)
  39. jt.GET("/df", c.JtDfList)
  40. jt.GET("/contact", c.JtContactInfo)
  41. jt.GET("/page_pic", c.PagePicList)
  42. }
  43. }
  44. }