19 lines
346 B
Go
19 lines
346 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"log"
|
||
|
"net/http"
|
||
|
)
|
||
|
|
||
|
// main it's the snippetbox webapp
|
||
|
func main() {
|
||
|
mux := http.NewServeMux()
|
||
|
mux.HandleFunc("/", home)
|
||
|
mux.HandleFunc("/snippet/view", snippetView)
|
||
|
mux.HandleFunc("/snippet/create", snippetCreate)
|
||
|
|
||
|
log.Print("starting a server on :4000")
|
||
|
err := http.ListenAndServe(":4000", mux)
|
||
|
log.Fatal(err)
|
||
|
}
|