potential reboot

main
Nathan Wagner 1 year ago
parent ff1f32a698
commit 69131bb1a5

@ -1,18 +1,23 @@
package main package main
import ( import (
"flag"
"log" "log"
"net/http" "net/http"
"os"
) )
func main() { func main() {
addr := flag.String("addr", ":4000", "HTTP network address")
flag.Parse()
infoLog := log.New(os.Stdout, "INFO\t", log.Ldate|log.Ltime)
mux := http.NewServeMux() mux := http.NewServeMux()
fileServer := http.FileServer(http.Dir("./ui/static/")) fileServer := http.FileServer(http.Dir("./ui/static/"))
mux.Handle("/static/", http.StripPrefix("/static", fileServer)) mux.Handle("/static/", http.StripPrefix("/static", fileServer))
mux.HandleFunc("/", home) mux.HandleFunc("/", home)
mux.HandleFunc("/snippet/view", snippetView) mux.HandleFunc("/snippet/view", snippetView)
mux.HandleFunc("/snippet/create", snippetCreate) mux.HandleFunc("/snippet/create", snippetCreate)
log.Print("Starting server on :4000") log.Printf("Starting server on %s", *addr)
err := http.ListenAndServe(":4000", mux) err := http.ListenAndServe(*addr, mux)
log.Fatal(err) log.Fatal(err)
} }

Loading…
Cancel
Save