[CI] pgitBot
·
2026-02-26
webServer.go
Go
1//usr/bin/env go run "$0" "$@"; exit "$?"
2//go:build exclude
3package main
4import (
5 "net/http"
6 "log"
7 "os"
8)
9func main() {
10 http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
11 log.Printf("Request: %s %s", r.Method, r.URL)
12 http.FileServer(http.Dir(T(len(os.Args)>=1, os.Args[1], "public"))).ServeHTTP(w, r)
13 })
14 log.Fatal(http.ListenAndServe(":1313", nil))
15}
16func T[T any](c bool, t, f T) T { if c { return t } else { return f } }