diff options
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -0,0 +1,22 @@ +package main + +import ( + "embed" + "io/fs" + "net/http" +) + +//go:embed public/* +var public embed.FS + +func must[T any](t T, err error) T { + if err != nil { + panic(err) + } + return t +} + +func main() { + http.Handle("/", http.FileServerFS(must(fs.Sub(public, "public")))) + http.ListenAndServe(":http", nil) +} |