From f99a663cabcfcad97eba5b37eea718c496b89300 Mon Sep 17 00:00:00 2001 From: valentimarco Date: Thu, 5 Dec 2024 19:29:02 +0100 Subject: [PATCH] refactor(basic Template): add log middleware --- cmd/new.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cmd/new.go b/cmd/new.go index 21f2aff..13518cb 100644 --- a/cmd/new.go +++ b/cmd/new.go @@ -135,19 +135,20 @@ var ( newBasicTemplate = `package main import ( - "log" + "github.com/gofiber/fiber/v2/middleware/logger" - "github.com/gofiber/fiber/v2" + "github.com/gofiber/fiber/v2" ) func main() { - app := fiber.New() + app := fiber.New() + app.Use(logger.New()) - app.Get("/", func(c *fiber.Ctx) error { - return c.SendString("Hello, World!") - }) + app.Get("/", func(c *fiber.Ctx) error { + return c.SendString("Hello, World!") + }) - log.Fatal(app.Listen(":3000")) + app.Listen(":3000") }` newSuccessTemplate = `