123456789101112131415161718192021222324252627282930313233343536373839404142 |
- package main
- import (
- "byom-infra-api/config"
- "byom-infra-api/handlers"
- "byom-infra-api/routes"
- "log"
- "net/http"
- "github.com/gorilla/mux"
- )
- func main() {
- // Initialize the OVH client configuration for API interactions
- config.InitOVHClient()
- // Initialize the BYOM configuration file
- err := config.InitByomConfig()
- if err != nil {
- log.Fatalf("Failed to initialize config: %v", err)
- }
- log.Printf("BYOM Config initialized successfully")
- // Load all handlers from the handlers package
- log.Printf("Loading handlers...")
- dnshandler := handlers.NewDNSHandler()
- // Create a new Gorilla Mux router instance for handling HTTP requests
- r := mux.NewRouter()
- // Configure all application routes and their handlers
- routes.SetupRoutes(r, dnshandler)
- log.Println("Routes configured...")
- // Start the HTTP server on port 8080
- // Log server startup message
- log.Println("Server starting on port 8080...")
- // Listen and serve HTTP requests, log fatal error if server fails to start
- if err := http.ListenAndServe(":8080", r); err != nil {
- log.Fatal(err)
- }
- }
|