~kota/granola

92edfc46f656646f91111f570267fb54ad8a8b20 — Dakota Walsh 2 months ago 2ec11bf
Add addr flag
1 files changed, 6 insertions(+), 2 deletions(-)

M cmd/granola/main.go
M cmd/granola/main.go => cmd/granola/main.go +6 -2
@@ 1,11 1,15 @@
package main

import (
	"flag"
	"log"
	"net/http"
)

func main() {
	addr := flag.String("addr", ":4000", "HTTP network address")
	flag.Parse()

	mux := http.NewServeMux()

	fileServer := http.FileServer(http.Dir("./ui/static"))


@@ 17,7 21,7 @@ func main() {
	mux.HandleFunc("/new/club", newClub)
	mux.HandleFunc("/new/post", newPost)

	log.Println("Starting server on :4000")
	err := http.ListenAndServe(":4000", mux)
	log.Printf("Starting server on %s", *addr)
	err := http.ListenAndServe(*addr, mux)
	log.Fatal(err)
}