Spaces:
Paused
Paused
chore: minimal survival build
Browse files
main.go
CHANGED
|
@@ -7,29 +7,21 @@ import (
|
|
| 7 |
)
|
| 8 |
|
| 9 |
func main() {
|
| 10 |
-
//
|
| 11 |
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
| 12 |
http.ServeFile(w, r, "index.html")
|
| 13 |
})
|
| 14 |
|
| 15 |
-
//
|
| 16 |
-
/
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
log.Printf("Error recuperado: %v", r)
|
| 20 |
-
}
|
| 21 |
-
}()
|
| 22 |
-
|
| 23 |
-
// Llama a la l贸gica de tus otros archivos
|
| 24 |
-
InitRoutes()
|
| 25 |
|
| 26 |
-
// 3. Configuraci贸n del puerto
|
| 27 |
port := os.Getenv("PORT")
|
| 28 |
if port == "" { port = "7860" }
|
| 29 |
|
| 30 |
-
log.Printf("
|
| 31 |
-
err := http.ListenAndServe(":" + port, nil)
|
| 32 |
-
if err != nil {
|
| 33 |
log.Fatal(err)
|
| 34 |
}
|
| 35 |
-
}
|
|
|
|
| 7 |
)
|
| 8 |
|
| 9 |
func main() {
|
| 10 |
+
// Servir la interfaz visual (HOI4)
|
| 11 |
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
| 12 |
http.ServeFile(w, r, "index.html")
|
| 13 |
})
|
| 14 |
|
| 15 |
+
// Endpoint de emergencia para ver si el servidor vive
|
| 16 |
+
http.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
|
| 17 |
+
w.Write([]byte("OK - FRENTE ORIENTAL OPERATIVO"))
|
| 18 |
+
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
|
|
|
| 20 |
port := os.Getenv("PORT")
|
| 21 |
if port == "" { port = "7860" }
|
| 22 |
|
| 23 |
+
log.Printf("Arrancando servidor en puerto %s", port)
|
| 24 |
+
if err := http.ListenAndServe(":" + port, nil); err != nil {
|
|
|
|
| 25 |
log.Fatal(err)
|
| 26 |
}
|
| 27 |
+
}
|