feat: add jwt

This commit is contained in:
fallen-angle
2022-02-10 17:08:42 +08:00
parent 77f7d0caad
commit 2d43931fc8
10 changed files with 165 additions and 5 deletions

17
handler/article.go Normal file
View File

@@ -0,0 +1,17 @@
package handler
import (
"fmt"
"nCovTrack-Backend/models"
"nCovTrack-Backend/utils"
"github.com/gin-gonic/gin"
"github.com/golang-jwt/jwt/v4"
)
func SaveArticleHandler(c *gin.Context) {
var articleSave models.Article
c.ShouldBindJSON(&articleSave)
fmt.Println(utils.RenewToken("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NDMxMDA5MDAsImlhdCI6MTY0MzQyNDkwMH0.L8qNmbHJtV8fiKKxGbkZk3DrKBPdvhie_oFooH5hGOY"))
utils.Succ(c, map[string]string{"string": utils.GenerateToken(jwt.MapClaims{})})
}