Skip to content

Instantly share code, notes, and snippets.

@onlyangel
Created April 5, 2012 05:38
Show Gist options
  • Select an option

  • Save onlyangel/2308265 to your computer and use it in GitHub Desktop.

Select an option

Save onlyangel/2308265 to your computer and use it in GitHub Desktop.
19 lines for a web server in Go Lang
package main
import (
"fmt"
"net/http"
)
type Hello struct{}
func (h Hello) ServeHTTP(
w http.ResponseWriter,
r *http.Request) {
fmt.Fprint(w, "Hello!")
}
func main() {
var h Hello
http.ListenAndServe("localhost:4000",h)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment