|
|
@ -17,7 +17,7 @@ func Greet(writer io.Writer, name string) {
|
|
|
|
|
|
|
|
|
|
|
|
// Here you can see that since now our greeter function takes an object that
|
|
|
|
// Here you can see that since now our greeter function takes an object that
|
|
|
|
// implements the io.Writer interface we can now pass an object like the http.ResponseWriter
|
|
|
|
// implements the io.Writer interface we can now pass an object like the http.ResponseWriter
|
|
|
|
// to it.
|
|
|
|
// to it. DI let's us reuse our code in a new context.
|
|
|
|
func MyGreeterHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
func MyGreeterHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
Greet(w, "world")
|
|
|
|
Greet(w, "world")
|
|
|
|
}
|
|
|
|
}
|
|
|
|