This commit is contained in:
@@ -5,10 +5,12 @@ import (
|
||||
"kontor-api-fiber/pkg/schema"
|
||||
"kontor-api-fiber/pkg/web"
|
||||
"log"
|
||||
"time"
|
||||
|
||||
jwtware "github.com/gofiber/contrib/v3/jwt"
|
||||
"github.com/gofiber/fiber/v3"
|
||||
"github.com/gofiber/fiber/v3/middleware/logger"
|
||||
"github.com/gofiber/fiber/v3/middleware/static"
|
||||
"github.com/gofiber/template/html/v3"
|
||||
)
|
||||
|
||||
@@ -22,7 +24,8 @@ func main() {
|
||||
engine := html.New("./views", ".html")
|
||||
|
||||
app := fiber.New(fiber.Config{
|
||||
Views: engine,
|
||||
Views: engine,
|
||||
ViewsLayout: "layouts/main",
|
||||
})
|
||||
|
||||
//app.Use(logger.New())
|
||||
@@ -38,8 +41,20 @@ func main() {
|
||||
api.Use(logger.New())
|
||||
handler.SetupComicRoutes(api)
|
||||
handler.SetupMediaRoutes(api)
|
||||
|
||||
app.Get("/*", static.New("./static", static.Config{
|
||||
Browse: false,
|
||||
MaxAge: 3600,
|
||||
CacheDuration: 10 * time.Second,
|
||||
NotFoundHandler: func(c fiber.Ctx) error {
|
||||
return c.Status(fiber.StatusNotFound).JSON(fiber.Map{
|
||||
"error": "asset not found",
|
||||
"path": c.Path(),
|
||||
})
|
||||
},
|
||||
}))
|
||||
// Listen on port 8900
|
||||
app.Listen(":8500")
|
||||
app.Listen(":8510")
|
||||
|
||||
log.Println("Kontor finished")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user