route.go 760 B

12345678910111213141516171819202122232425262728293031323334353637
  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. "access-control-monitor/controller/v1"
  8. _ "access-control-monitor/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. c := v1.NewController()
  16. // 服务健康检查
  17. engine.PUT("/ping", c.Ping)
  18. // version 1
  19. apiv1 := engine.Group("/api/v1")
  20. {
  21. apiv1.PUT("/auth", c.Auth)
  22. apiv1.POST("/register", c.Register)
  23. apiv1.PUT("/delete", c.StaffDelete)
  24. apiv1.PUT("/attendance", c.Attendance)
  25. //apiv1.GET("/batch_download", c.BatchDownload)
  26. //apiv1.PUT("/feedback", c.FeedBack)
  27. }
  28. }