add authentication for kontor-api-go

This commit is contained in:
Thomas Peetz
2025-12-01 06:53:03 +01:00
parent 741032ec02
commit 46bca919d7
5 changed files with 66 additions and 2 deletions
+9 -1
View File
@@ -5,6 +5,7 @@ import (
"kontor-api-go/pkg/schema"
"log"
jwtware "github.com/gofiber/contrib/jwt"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/logger"
)
@@ -18,10 +19,17 @@ func main() {
app := fiber.New()
// app.Use(jwtware.New(jwtware.Config{
// SigningKey: jwtware.SigningKey{Key: []byte("secret")},
// }))
// app.Use(logger.New())
app.Get("/health", handler.GetHealth)
app.Post("/login", handler.Login)
api := app.Group("/api", logger.New())
api := app.Group("/api", logger.New(), jwtware.New(jwtware.Config{
SigningKey: jwtware.SigningKey{Key: []byte("secret")},
}))
handler.SetupComicRoutes(api)
handler.SetupMediaRoutes(api)
// Listen on port 8900