-
Notifications
You must be signed in to change notification settings - Fork 10
/
router.go
23 lines (20 loc) · 799 Bytes
/
router.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
* Copyright 2023 FormulaGo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
*/
package main
import (
"formulago/biz/handler/middleware"
"formulago/configs"
"formulago/data"
"github.com/cloudwego/hertz/pkg/app/server"
)
// customizeRegister registers customize routers.
func customizedRegister(r *server.Hertz) {
// your code ...
// login and refresh_token power by jwt Auth middleware
r.POST("/api/login", middleware.GetJWTMiddleware(configs.Data(), data.Default(), data.CasbinEnforcer()).LoginHandler)
r.POST("/api/logout", middleware.GetJWTMiddleware(configs.Data(), data.Default(), data.CasbinEnforcer()).LogoutHandler)
r.POST("/api/refresh_token", middleware.GetJWTMiddleware(configs.Data(), data.Default(), data.CasbinEnforcer()).RefreshHandler)
}