aboutsummaryrefslogtreecommitdiff
path: root/cmd/httpdebug/main.go
blob: 1f7a04268a2984dc7ca96a0378ed1de066cd2725 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package main

import (
	"flag"
	"fmt"
	"io"
	"log"
	"log/slog"
	"net/http"
	"os"

	"within.website/x/internal"
)

var (
	bind = flag.String("bind", ":3000", "TCP port to bind to")
)

func main() {
	internal.HandleStartup()

	slog.Info("listening", "url", "http://localhost"+*bind)
	log.Fatal(http.ListenAndServe(*bind, http.HandlerFunc(
		func(w http.ResponseWriter, r *http.Request) {
			fmt.Println("---")
			r.Write(io.MultiWriter(w, os.Stdout))
			fmt.Println("---")
		},
	)))
}