This commit is contained in:
lbenedar
2026-02-27 14:22:29 +03:00
parent 2e513bb91e
commit e738975535
2 changed files with 17 additions and 12 deletions

View File

@@ -2,7 +2,6 @@ package main
import (
"fmt"
"log"
"net/http"
"strconv"
)
@@ -32,14 +31,3 @@ func snippetCreate(w http.ResponseWriter, r *http.Request) {
}
w.Write([]byte("Create a new snippet"))
}
func main() {
mux := http.NewServeMux()
mux.HandleFunc("/", home)
mux.HandleFunc("/snippet/view", snippetView)
mux.HandleFunc("/snippet/create", snippetCreate)
log.Print("Starting server on :4000")
err := http.ListenAndServe(":4000", mux)
log.Fatal(err)
}

17
cmd/web/main.go Normal file
View File

@@ -0,0 +1,17 @@
package main
import (
"log"
"net/http"
)
func main() {
mux := http.NewServeMux()
mux.HandleFunc("/", home)
mux.HandleFunc("/snippet/view", snippetView)
mux.HandleFunc("/snippet/create", snippetCreate)
log.Print("Starting server on :4000")
err := http.ListenAndServe(":4000", mux)
log.Fatal(err)
}