Files
toutoukan/router/setupRouter.go

30 lines
587 B
Go
Raw Normal View History

2025-08-10 02:11:35 +08:00
package router
import (
"github.com/gin-gonic/gin"
"toutoukan/controllers/system"
2025-08-10 20:34:58 +08:00
"toutoukan/controllers/test"
2025-08-10 02:11:35 +08:00
"toutoukan/controllers/user"
2025-08-10 05:57:51 +08:00
"toutoukan/socket"
2025-08-10 20:34:58 +08:00
"toutoukan/utill"
2025-08-10 02:11:35 +08:00
)
func SetupRouter() *gin.Engine {
r := gin.Default()
apiGroup := r.Group("/user")
{
apiGroup.POST("/login", user.UserLogin)
2025-08-10 20:34:58 +08:00
apiGroup.POST("/test", utill.JWTAuthMiddleware(), test.Testjwt)
2025-08-10 02:11:35 +08:00
}
r.GET("/socket", utill.JWTAuthMiddleware(), func(c *gin.Context) {
2025-08-10 05:57:51 +08:00
socket.WebsocketHandler(c)
})
systemGroup := r.Group("/system")
{
systemGroup.POST("/sendMsg", system.SendMsg)
}
2025-08-10 02:11:35 +08:00
return r
}