package api

import (
	"fmt"
	"os"
	"spekulaas/authentes/database"

	"github.com/gin-gonic/gin"
)

func Init(db *database.DatabaseController) {
	// set release mode if not in dev env
	if os.Getenv("ENV") != "development"{
		gin.SetMode(gin.ReleaseMode)
	}

	// start router
    router := gin.Default()

	// set ports
	Routes(router, db)

	// listening at port
    router.Run(fmt.Sprintf("%s",os.Getenv("PORT")))
}
