42 lines
811 B
Go
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"))
|
|
|
|
}
|