Created
July 19, 2018 10:48
-
-
Save lotusirous/7d012e6fb1867e667febbba9167f0fe1 to your computer and use it in GitHub Desktop.
Go simple web server.
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
| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "net/http" | |
| ) | |
| func main() { | |
| http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { | |
| fmt.Fprintf(w, "Hello, you've requested: %s\n", r.URL.Path) | |
| log.Println(r.URL.Path) | |
| }) | |
| log.Println("Starting") | |
| http.ListenAndServe(":8080", nil) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment