Last active
February 22, 2021 13:11
-
-
Save samirkape/afe02fe7e334e14fccb2b9226d53525f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// a minimal http server | |
package main | |
import ( | |
"fmt" | |
"net/http" | |
) | |
func handler(w http.ResponseWriter, req *http.Request) { | |
fmt.Fprintf(w, "hello\n") | |
} | |
func main() { | |
http.HandleFunc("/hello", handler) | |
http.ListenAndServe("localhost:8090", nil) | |
} | |
/* | |
$ go run http-servers.go & | |
$ curl localhost:8090/hello | |
hello | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment