Skip to content

Commit

Permalink
Added new endpoint reverse_2
Browse files Browse the repository at this point in the history
  • Loading branch information
Thanasis Politis committed Mar 25, 2023
1 parent c525762 commit 3ba54d2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,13 @@ func main() {
fmt.Fprintf(w, "Hello, %s!\n", reversed)
})

http.HandleFunc("/reverse_2", func(w http.ResponseWriter, r *http.Request) {
reversed, err := reverser.Reverse(r.Context(), r.URL.Query().Get("name"))
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
fmt.Fprintf(w, "Hello, %s!\n", reversed)
})

http.Serve(lis, nil)
}

0 comments on commit 3ba54d2

Please sign in to comment.