20 lines
450 B
Go
20 lines
450 B
Go
|
|
package gin
|
||
|
|
|
||
|
|
import (
|
||
|
|
"github.com/gin-gonic/gin"
|
||
|
|
"myschools.me/heritage/heritage-api/handler"
|
||
|
|
)
|
||
|
|
|
||
|
|
// 路由配置
|
||
|
|
func routerSetup(router *gin.Engine) {
|
||
|
|
router.Use(gin.Recovery())
|
||
|
|
api := router.Group("/api")
|
||
|
|
api.POST("/login", handler.Login)
|
||
|
|
|
||
|
|
protected := router.Group("/api")
|
||
|
|
protected.Use(auth(), authorize())
|
||
|
|
protected.POST("/logout", handler.Logout)
|
||
|
|
protected.GET("/me", handler.Me)
|
||
|
|
protected.POST("/password", handler.ChangePassword)
|
||
|
|
}
|