feat: Implement dependencies
@@ -11,6 +11,11 @@ import (
_ "github.com/go-sql-driver/mysql"
"github.com/gofiber/fiber/v2"
+ "github.com/gofiber/fiber/v2/middleware/cache"
+ "github.com/gofiber/fiber/v2/middleware/compress"
+ "github.com/gofiber/fiber/v2/middleware/cors"
+ "github.com/gofiber/fiber/v2/middleware/logger"
+ "github.com/gofiber/fiber/v2/middleware/recover"
)
func main() {
@@ -26,6 +31,13 @@ func main() {
ServerHeader: "Fiber",
})
+ // Use global middlewares.
+ app.Use(cache.New())
+ app.Use(cors.New())
+ app.Use(compress.New())
+ app.Use(logger.New())
+ app.Use(recover.New())
+
// Create repositories.
cityRepository := city.NewCityRepository(mariadb)
userRepository := user.NewUserRepository(mariadb)
