aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/main.go b/main.go
new file mode 100644
index 0000000..97d40a4
--- /dev/null
+++ b/main.go
@@ -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)
+}