✨ init project
This commit is contained in:
15
router/app/login.go
Normal file
15
router/app/login.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"Lee-WineList/api/app"
|
||||
"Lee-WineList/middleware"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// 登录相关
|
||||
func login(g *gin.RouterGroup) {
|
||||
// 登录相关接口
|
||||
g.POST("/token", app.LoginApi().Login)
|
||||
g.POST("/token/refresh", app.LoginApi().Refresh)
|
||||
g.POST("/token/logout", middleware.AuthorizeToken(), app.LoginApi().Logout)
|
||||
}
|
12
router/app/route.go
Normal file
12
router/app/route.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"Lee-WineList/middleware"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// InitRoute 初始化路由
|
||||
func InitRoute(g *gin.RouterGroup) {
|
||||
login(g) // 登录相关路由
|
||||
user(g.Group("/user", middleware.AuthorizeToken())) // 用户相关路由
|
||||
}
|
13
router/app/user.go
Normal file
13
router/app/user.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"Lee-WineList/api/app"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// 用户相关路由
|
||||
func user(g *gin.RouterGroup) {
|
||||
g.GET("", app.UserApi().GetUser) // 获取当前登录用户信息
|
||||
g.POST("/binding/wechat", app.UserApi().BindingWeChat) // 绑定微信
|
||||
g.POST("/update", app.UserApi().UpdateUser) // 修改用户信息
|
||||
}
|
Reference in New Issue
Block a user