Add server skeleton with directory app and local dev loop

This commit is contained in:
Ian Gulliver
2026-08-15 13:07:45 -07:00
parent 4f73673735
commit 80b274c544
8 changed files with 369 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
// Heliosian serves the Helios school community apps.
package main
import (
"log"
"net/http"
"os"
"heliosian/internal/data"
"heliosian/internal/directory"
)
func main() {
mux := http.NewServeMux()
directory.Register(mux, data.Dir{Root: "sampledata"})
mux.Handle("GET /{$}", http.RedirectHandler("/directory/", http.StatusFound))
port := os.Getenv("PORT")
if port == "" {
port = "8080"
}
log.Printf("listening on http://localhost:%s", port)
log.Fatal(http.ListenAndServe(":"+port, mux))
}