Skip to content

Instantly share code, notes, and snippets.

@mlabouardy
Created October 24, 2017 12:27
Show Gist options
  • Save mlabouardy/d47c7953b1e742628725248fca520319 to your computer and use it in GitHub Desktop.
Save mlabouardy/d47c7953b1e742628725248fca520319 to your computer and use it in GitHub Desktop.
simple http server in go
package main
import (
"fmt"
"log"
"net/http"
)
func HomeEndpoint(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "Hello world :)")
}
func main() {
http.HandleFunc("/", HomeEndpoint)
if err := http.ListenAndServe(":3000", nil); err != nil {
log.Fatal(err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment