Skip to content

Instantly share code, notes, and snippets.

@Adron
Created May 29, 2017 22:20
Show Gist options
  • Select an option

  • Save Adron/59af8efc98e82dc82fd6d4b8f8652fd3 to your computer and use it in GitHub Desktop.

Select an option

Save Adron/59af8efc98e82dc82fd6d4b8f8652fd3 to your computer and use it in GitHub Desktop.
Go Hello World style app that does some actual processing.
package main
import (
"bytes"
"fmt"
"log"
"net/http"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
var buffer bytes.Buffer
for i := 0; i < 1000; i++ {
buffer.WriteString("a")
}
fmt.Fprintf(w, buffer.String()+"Hello!")
})
log.Println("Listening on 8080...")
log.Fatal(http.ListenAndServe(":8080", nil))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment