initial commit

This commit is contained in:
2025-12-13 17:40:55 +01:00
parent 3219445d37
commit 726db69115
32 changed files with 4411 additions and 264 deletions

View File

@@ -0,0 +1,26 @@
package server
import (
"time"
"github.com/gin-gonic/gin"
"github.com/golang-jwt/jwt/v5"
)
var secret = []byte("secret")
func StartServer() {
r := gin.Default()
r.POST("/login", func(c *gin.Context) {
token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{
"user": "demo",
"role": "admin",
"exp": time.Now().Add(24 * time.Hour).Unix(),
})
signed, _ := token.SignedString(secret)
c.JSON(200, gin.H{"token": signed})
})
}