20 lines
327 B
Go
20 lines
327 B
Go
|
package greet
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"io"
|
||
|
"net/http"
|
||
|
)
|
||
|
|
||
|
func Greet(writer io.Writer, name string) {
|
||
|
fmt.Fprintf(writer, "Hello, %s", name)
|
||
|
}
|
||
|
|
||
|
func MyGreeterHandler(w http.ResponseWriter, r *http.Request) {
|
||
|
Greet(w, "world")
|
||
|
}
|
||
|
|
||
|
// func main() {
|
||
|
// log.Fatal(http.ListenAndServe(":5001", http.HandlerFunc(MyGreeterHandler)))
|
||
|
// }
|