Skip to content

Instantly share code, notes, and snippets.

@portalsoup
Created December 15, 2015 21:14
Show Gist options
  • Save portalsoup/bd81c0bdc765ade0247f to your computer and use it in GitHub Desktop.
Save portalsoup/bd81c0bdc765ade0247f to your computer and use it in GitHub Desktop.
Basic hello world golang web server
package main
import (
"net/http"
"io"
)
func helloHandler(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, "Hello world!")
}
func main() {
http.HandleFunc("/hello", helloHandler)
http.ListenAndServe(":8080", nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment