Skip to content

Commit

Permalink
add root URL handle
Browse files Browse the repository at this point in the history
  • Loading branch information
Hroman9n committed Dec 15, 2023
1 parent b0cb473 commit d1ad3ef
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ import (
// {ID: "3", Title: "Madvillain", Artist: "MF DOOM", Price: 5},
// }

// func getAlbums() {}
func root(w http.ResponseWriter, req *http.Request) {
fmt.Fprintf(w, "You can use endpoints such '/hello' and '/headers' for test")
}

func hello(w http.ResponseWriter, req *http.Request) {
fmt.Fprint(w, "Hello!\n")
Expand All @@ -36,6 +38,7 @@ func headers(w http.ResponseWriter, req *http.Request) {
}

func main() {
http.HandleFunc("/", root)
http.HandleFunc("/hello", hello)
http.HandleFunc("/headers", headers)

Expand Down

0 comments on commit d1ad3ef

Please sign in to comment.