Skip to content

Instantly share code, notes, and snippets.

@lotusirous
Created July 19, 2018 10:48
Show Gist options
  • Select an option

  • Save lotusirous/7d012e6fb1867e667febbba9167f0fe1 to your computer and use it in GitHub Desktop.

Select an option

Save lotusirous/7d012e6fb1867e667febbba9167f0fe1 to your computer and use it in GitHub Desktop.
Go simple web server.
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