Viewing:
package main import ( "cmp" embed "embed" "log" "net/http" "os" ) //go:embed content/* var f embed.FS var port = cmp.Or(os.Getenv("ASTR_PORT"), "12345") func main() { data, _ := f.ReadFile("hello.txt") print(string(data)) fs := http.FileServer(http.FS(f)) http.Handle("/", fs) log.Printf("Listening on :%s...", port) err := http.ListenAndServe(":"+port, nil) if err != nil { log.Fatal(err) } }