A simple look at some basic ways of getting HTTP routing of GET requests in Go.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
243 B

package main
import (
"fmt"
"log"
"net/http"
)
func main() {
http.HandleFunc("/hello", HelloHTTP)
log.Fatal(http.ListenAndServe(":8080", nil))
}
func HelloHTTP(w http.ResponseWriter, req *http.Request) {
fmt.Fprint(w, "Hello HTTP")
}