package main import ( //"fmt" "crowsnest/internal/data" "crowsnest/internal/model" "fmt" "html/template" "net/http" ) func index(w http.ResponseWriter, req *http.Request) { fds, _ := data.NewFileDatastore("./persistence/spiegel100.json") repo, _ := data.NewDefaultRepository[*model.Article](fds, "article") articles, _ := repo.GetAll() t := template.Must(template.ParseFiles("templates/article.html", "templates/layout.html")) _ = t.ExecuteTemplate(w, "base", articles) } func main() { // routes http.HandleFunc("/", index) // serve files from the "static" directory fs := http.FileServer(http.Dir("./static")) http.Handle("/static", http.StripPrefix("/", fs)) t := template.Must(template.ParseFiles("templates/article.html")) fmt.Println(t) // start server http.ListenAndServe(":8080", nil) }