Files
snippetbox/cmd/web/main.go
lbenedar 00ac7cf707 ch2.9
2026-03-04 13:30:23 +03:00

21 lines
432 B
Go

package main
import (
"log"
"net/http"
)
func main() {
mux := http.NewServeMux()
fileServer := http.FileServer(http.Dir("./ui/static/"))
mux.HandleFunc("/", home)
mux.HandleFunc("/snippet/view", snippetView)
mux.HandleFunc("/snippet/create", snippetCreate)
mux.Handle("/static/", http.StripPrefix("/static", fileServer))
log.Print("Starting server on :4000")
err := http.ListenAndServe(":4000", mux)
log.Fatal(err)
}