initial commit

This commit is contained in:
Bartal Laearsson
2026-07-24 21:38:32 +01:00
commit fb91a40032
10 changed files with 540 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
package main
import (
"log/slog"
"net/http"
"os"
)
const webPort = ":7654"
func main() {
logger := slog.New(slog.NewJSONHandler(os.Stdout, nil))
slog.SetDefault(logger)
mux := http.NewServeMux()
mux.Handle("/", http.FileServer(http.Dir("./static")))
cs := newChatServer()
mux.Handle("/ws/", http.StripPrefix("/ws", cs))
slog.Info("starting wschat web server", "port", webPort)
if err := http.ListenAndServe(webPort, mux); err != nil {
slog.Error("unable to listen and serve", "port", webPort, "error", err)
os.Exit(1)
}
}