package main
import (
"embed"
"html/template"
"log"
"net/http"
"os"
)
//go:embed static/*
var static embed.FS
//go:embed templates/*.html
var templates embed.FS
func main() {
http.Handle("/static/", http.FileServer(http.FS(static)))
t, err := template.ParseFS(templates, "templates/*.html")
if err != nil {
log.Fatal(err)
}
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
t.ExecuteTemplate(w, "index.html", "Phylactery")
})
addr := os.Getenv("PHYLACTERY_ADDRESS")
log.Println("Listening on", addr)
log.Fatal(http.ListenAndServe(addr, nil))
}