Skip to content

Instantly share code, notes, and snippets.

@khannedy
Created April 25, 2022 03:29
Show Gist options
  • Save khannedy/9262c7784a9ef65ced9dac712822a853 to your computer and use it in GitHub Desktop.
Save khannedy/9262c7784a9ef65ced9dac712822a853 to your computer and use it in GitHub Desktop.
Golang Web Hello World
package main
import (
"fmt"
"net/http"
)
func main() {
http.HandleFunc("/", HelloServer)
http.ListenAndServe(":8080", nil)
}
func HelloServer(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, World!")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment