I am trying to learn web programming with Go. I stared out with a simple "hello world" web server:
package main
import "fmt"
import "net/http"
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Hello, world")
}
func main() {
http.HandleFunc("/", handler)
http.ListenAndServe(":8080", nil)
}
And when I go to
http://localhost:8080/handler
in the browser, the browser can´t seem to find anything and nothing happens. What could be the reason for this?