12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- // 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"
- "access-control-monitor/controller/v1"
- _ "access-control-monitor/docs"
- )
- func SetupRoute(engine *gin.Engine) {
- // 404页面
- engine.NoRoute(func(c *gin.Context) {
- c.String(http.StatusNotFound, "Not Found")
- })
- c := v1.NewController()
- // 服务健康检查
- engine.PUT("/ping", c.Ping)
- // version 1
- apiv1 := engine.Group("/api/v1")
- {
- apiv1.PUT("/auth", c.Auth)
- apiv1.PUT("/attendance", c.Attendance)
- team := apiv1.Group("/team")
- {
- team.POST("", c.TeamInfoAdd)
- team.PUT("", c.TeamUpdate)
- team.PUT("/del", c.TeamDelete)
- }
- staff := apiv1.Group("/staff")
- {
- staff.POST("", c.Register)
- staff.PUT("", c.StaffUpdate)
- staff.PUT("/del", c.StaffDelete)
- }
- }
- }
|