2023-09-17 14:28:54 +00:00
|
|
|
package main
|
|
|
|
|
2023-09-18 09:15:19 +00:00
|
|
|
import (
|
2024-01-08 15:58:43 +00:00
|
|
|
"embed"
|
2023-09-18 09:15:19 +00:00
|
|
|
"log"
|
|
|
|
"net/http"
|
|
|
|
"os"
|
|
|
|
)
|
2023-09-17 14:28:54 +00:00
|
|
|
|
2024-01-08 15:58:43 +00:00
|
|
|
//go:embed templates
|
|
|
|
var embed_templates embed.FS
|
|
|
|
|
2023-09-17 14:28:54 +00:00
|
|
|
func main() {
|
2023-09-18 09:15:19 +00:00
|
|
|
port := os.Getenv("PORT")
|
|
|
|
if port == "" {
|
|
|
|
port = "8080"
|
|
|
|
log.Printf("Defaulting to port %s \n", port)
|
|
|
|
}
|
2023-09-17 14:28:54 +00:00
|
|
|
|
2023-09-18 09:15:19 +00:00
|
|
|
http.HandleFunc("/", handleRoot)
|
|
|
|
if err := http.ListenAndServe(":"+port, nil); err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
2023-09-17 14:28:54 +00:00
|
|
|
}
|