NAPPDesafio/api/main.go
2024-07-21 00:15:14 -03:00

42 lines
811 B
Go

package main
import (
authmodule "api/application/auth"
productsmodule "api/application/products"
"api/helpers/database"
"api/helpers/variable"
"api/libs/logger"
"api/libs/postgres"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/cors"
"github.com/gofiber/fiber/v2/middleware/helmet"
loggerFiber "github.com/gofiber/fiber/v2/middleware/logger"
"github.com/gofiber/fiber/v2/middleware/recover"
)
func main() {
logger.InitializeLogger()
postgres.InitializeDatabaseConnection()
database.Init()
app := fiber.New()
app.Use(recover.New())
app.Use(helmet.New())
app.Use(cors.New(cors.ConfigDefault))
app.Use(loggerFiber.New())
authmodule.AuthModuleDecorator(app)
productsmodule.ProductstModuleDecorator(app)
app.Listen(":" + variable.GetEnvVariable("PORT"))
}