Compare commits
No commits in common. "feature" and "main" have entirely different histories.
9
main.go
9
main.go
@ -32,11 +32,6 @@ func main() {
|
|||||||
b, _ := strconv.Atoi(r.URL.Query().Get("b"))
|
b, _ := strconv.Atoi(r.URL.Query().Get("b"))
|
||||||
json.NewEncoder(w).Encode(map[string]int{"result": sub(a, b)})
|
json.NewEncoder(w).Encode(map[string]int{"result": sub(a, b)})
|
||||||
})
|
})
|
||||||
mux.HandleFunc("/multiply", func(w http.ResponseWriter, r *http.Request) {
|
|
||||||
a, _ := strconv.Atoi(r.URL.Query().Get("a"))
|
|
||||||
b, _ := strconv.Atoi(r.URL.Query().Get("b"))
|
|
||||||
json.NewEncoder(w).Encode(map[string]int{"result": multiply(a, b)})
|
|
||||||
})
|
|
||||||
|
|
||||||
http.ListenAndServe(":8080", mux)
|
http.ListenAndServe(":8080", mux)
|
||||||
}
|
}
|
||||||
@ -48,7 +43,3 @@ func sum(a, b int) int {
|
|||||||
func sub(a, b int) int {
|
func sub(a, b int) int {
|
||||||
return a - b
|
return a - b
|
||||||
}
|
}
|
||||||
|
|
||||||
func multiply(a, b int) int {
|
|
||||||
return a * b
|
|
||||||
}
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user