2023-06-02 15:47:33 +02:00

32 lines
612 B
Go

package main
import (
"fmt"
"log"
"net/http"
)
type WebsiteStatus struct {
WebsiteURL string
Description string
HasIcon bool
IconURL string
}
func main() {
websites, err := readWebsitesFromFile("websites.conf")
if err != nil {
log.Fatal(err)
}
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
renderTemplate(w, websites)
})
http.HandleFunc("/check", handleCheck)
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static"))))
fmt.Println("Server listening on http://localhost:8080")
log.Fatal(http.ListenAndServe(":8080", nil))
}