feat: csrf tokens handling

This commit is contained in:
Iron_Felix 2025-12-04 06:13:03 +03:00
parent ab29c33f5b
commit 6995ce58f6
12 changed files with 233 additions and 5 deletions

View file

@ -11,6 +11,7 @@ import (
oapi "nyanimedb/api"
handlers "nyanimedb/modules/backend/handlers"
middleware "nyanimedb/modules/backend/middlewares"
"nyanimedb/modules/backend/rmq"
"github.com/gin-contrib/cors"
@ -45,6 +46,8 @@ func main() {
r := gin.Default()
r.Use(middleware.CSRFMiddleware())
// jwt middle will be here
queries := sqlc.New(pool)
// === RabbitMQ setup ===
@ -63,7 +66,6 @@ func main() {
rpcClient := rmq.NewRPCClient(rmqConn, 30*time.Second)
server := handlers.NewServer(queries, publisher, rpcClient)
// r.LoadHTMLGlob("templates/*")
r.Use(cors.New(cors.Config{
AllowOrigins: []string{"*"}, // allow all origins, change to specific domains in production