update kontor-fiber to use Go Fiber v3
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s

This commit is contained in:
2026-09-20 02:08:56 +02:00
parent 8f5a384e89
commit ad09386a7a
40 changed files with 545 additions and 279 deletions
+13 -9
View File
@@ -3,11 +3,13 @@ package main
import (
"kontor-api-fiber/pkg/handler"
"kontor-api-fiber/pkg/schema"
"kontor-api-fiber/pkg/web"
"log"
jwtware "github.com/gofiber/contrib/jwt"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/logger"
jwtware "github.com/gofiber/contrib/v3/jwt"
"github.com/gofiber/fiber/v3"
"github.com/gofiber/fiber/v3/middleware/logger"
"github.com/gofiber/template/html/v3"
)
func main() {
@@ -16,19 +18,21 @@ func main() {
if err := schema.Connect(); err != nil {
log.Fatal(err)
}
// Create a new engine
engine := html.New("./views", ".html")
app := fiber.New()
// app.Use(jwtware.New(jwtware.Config{
// SigningKey: jwtware.SigningKey{Key: []byte("secret")},
// }))
app := fiber.New(fiber.Config{
Views: engine,
})
//app.Use(logger.New())
app.Get("/health", handler.GetHealth)
app.Post("/login", handler.Login)
app.Get("/", web.Mainpage)
api := app.Group("/api", logger.New(), jwtware.New(jwtware.Config{
//api := app.Group("/api/v1")
api := app.Group("/api/v1", logger.New(), jwtware.New(jwtware.Config{
SigningKey: jwtware.SigningKey{Key: []byte("secret")},
}))
api.Use(logger.New())