usersrouter.go 687 B

123456789101112131415161718
  1. package routers
  2. import (
  3. "bigdata_archives/app/controller"
  4. middlewares "bigdata_archives/app/middleware"
  5. "github.com/gin-gonic/gin"
  6. )
  7. func UserRouter(r *gin.Engine) {
  8. group := r.Group("/api")
  9. group.POST("/login", controller.Login)
  10. group.GET("/archives", controller.Archives)
  11. group.POST("/user", controller.AddUser).Use(middlewares.AdminMiddleware())
  12. group.POST("/userlist", controller.UserList).Use(middlewares.AdminMiddleware())
  13. group.GET("/getuser", controller.GetUserById).Use(middlewares.AdminMiddleware())
  14. group.DELETE("/user", controller.DeleteUser).Use(middlewares.AdminMiddleware())
  15. group.PUT("/user", controller.UpdateUserById).Use(middlewares.AdminMiddleware())
  16. }