Feat: Add JWT config, auth middleware, and token parsing using username.
Signed-off-by: Goldbro233 <bowensun_06@outlook.com>
This commit is contained in:
@@ -2,6 +2,7 @@ package router
|
||||
|
||||
import (
|
||||
"GinTutorial/controllers"
|
||||
"GinTutorial/middlewares"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@@ -17,6 +18,13 @@ func SetupRouter() *gin.Engine {
|
||||
auth.POST("/login", controllers.Login)
|
||||
auth.POST("/register", controllers.Register)
|
||||
}
|
||||
|
||||
ex := v1.Group("/ex")
|
||||
{
|
||||
ex.GET("/exchangeRates", controllers.GetExchangeRates)
|
||||
ex.Use(middlewares.AuthMiddleWare())
|
||||
ex.POST("/exchangeRates", controllers.CreateExchangeRate)
|
||||
}
|
||||
}
|
||||
}
|
||||
return r
|
||||
|
||||
Reference in New Issue
Block a user