Skip to content

Instantly share code, notes, and snippets.

@drincruz
Created June 18, 2019 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drincruz/c0d718b93466781a1b77f0e43576181c to your computer and use it in GitHub Desktop.
Save drincruz/c0d718b93466781a1b77f0e43576181c to your computer and use it in GitHub Desktop.
Quick Golang HTTP Server
package main
import (
"fmt"
"time"
"net/http"
)
func main() {
http.HandleFunc("/", func (w http.ResponseWriter, r *http.Request) {
time.Sleep(5 * time.Second)
fmt.Fprintf(w, "{\"data\": \"p00t!\"}")
})
http.ListenAndServe(":80", nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment