39 lines
651 B
Go
39 lines
651 B
Go
|
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.")
|
||
|
}
|
||
|
}
|