12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- // Copyright 2019 github.com. All rights reserved.
- // Use of this source code is governed by github.com.
- package route
- import (
- "net/http"
- "github.com/gin-gonic/gin"
- "xingjia-official-gateway/controller/v1"
- _ "xingjia-official-gateway/docs"
- )
- func SetupRoute(engine *gin.Engine) {
- // 404页面
- engine.NoRoute(func(c *gin.Context) {
- c.String(http.StatusNotFound, "Not Found")
- })
- // 服务健康检查
- engine.GET("/ping", func(c *gin.Context) {
- // TODO 心跳检查
- c.String(http.StatusOK, "pong")
- })
- //engine.Use(middleware.Session("smart-site-supplier"))
- // version 1
- apiv1 := engine.Group("/api/v1")
- {
- c := v1.NewController()
- //engine.POST("/api/v1/user/login", c.Login)
- //apiv1.Use(middleware.Jwt())
- //apiv1.POST("/file", c.Upload)
- apiv1.GET("/file", c.DownLoad)
- //apiv1.PUT("/token_refresh", c.TokenRefresh)
- jt := apiv1.Group("/jt")
- {
- jt.GET("/desc", c.JtDescInfo)
- jt.GET("/vision", c.JtVisionInfo)
- jt.GET("/news", c.JtNewsList)
- jt.GET("/announcement", c.JtAnnouncementList)
- jt.GET("/program", c.JtProgramList)
- jt.GET("/lx", c.JtLxList)
- jt.GET("/hw", c.JtHwList)
- jt.GET("/df", c.JtDfList)
- jt.GET("/contact", c.JtContactInfo)
- jt.GET("/page_pic", c.PagePicList)
- }
- }
- }
|