You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
585 B
Go
24 lines
585 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"log"
|
|
"net/http"
|
|
"os"
|
|
)
|
|
|
|
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()
|
|
fileServer := http.FileServer(http.Dir("./ui/static/"))
|
|
mux.Handle("/static/", http.StripPrefix("/static", fileServer))
|
|
mux.HandleFunc("/", home)
|
|
mux.HandleFunc("/snippet/view", snippetView)
|
|
mux.HandleFunc("/snippet/create", snippetCreate)
|
|
log.Printf("Starting server on %s", *addr)
|
|
err := http.ListenAndServe(*addr, mux)
|
|
log.Fatal(err)
|
|
}
|