Skip to content

Instantly share code, notes, and snippets.

@khajer
Created January 27, 2018 05:14
Show Gist options
  • Select an option

  • Save khajer/56ce6e23de302bc554e04c06165e321a to your computer and use it in GitHub Desktop.

Select an option

Save khajer/56ce6e23de302bc554e04c06165e321a to your computer and use it in GitHub Desktop.
server.go
package main
import (
"fmt"
"net/http"
)
func HelloHandlers(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, world.")
}
func main() {
http.HandleFunc("/", HelloHandlers) // set router
http.ListenAndServe(":8080", nil) // set listen port
fmt.Println("server run at http://localhost:8080");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment