Initial commit

This commit is contained in:
2023-06-09 11:33:10 +02:00
commit 7c111f97ab
22 changed files with 2221 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
package middleware
import (
"os"
jwtware "github.com/gofiber/contrib/jwt"
"github.com/gofiber/fiber/v2"
)
func errorHandler(c *fiber.Ctx, err error) error {
c.Status(401)
return err
}
func Protected() fiber.Handler {
return jwtware.New(jwtware.Config{
SigningKey: jwtware.SigningKey{Key: []byte(os.Getenv("JWT_SECRET"))},
ErrorHandler: errorHandler,
})
}