Onyx-API/cmd/api/main.go

39 lines
651 B
Go
Raw Permalink Normal View History

2023-09-15 18:21:04 +02:00
package main
import (
"log"
"strconv"
"onyx-api/internal/config"
"onyx-api/internal/server"
)
func main() {
// Load config
log.Println("Loading Server Configurations...")
cfg, err := config.LoadConfig()
if err != nil {
log.Fatalf("Error loading config: %v", err)
}
// New server with proper config
App := server.NewServer(cfg, db, mail)
// Load Router
err = App.Routes()
if err != nil {
log.Fatalf("Error Loading routes: %v", err)
} else {
log.Printf("Routes loaded.")
}
// Run the server
err = App.Run()
if err != nil {
log.Fatalf("Error running the app: %v", err)
} else {
log.Printf("App up and running.")
}
}