I'm trying to write a basic http server example. I can curl localhost:8080, but can't contact the server with http.Get("127.0.0.1:8080") from the client script. What am I doing wrong?
server.go:
import "fmt"
import "net/http"
func join(w http.ResponseWriter, req *http.Request) {
fmt.Println("Someone joined")
}
func main() {
fmt.Println("Listening on port 8080...")
http.HandleFunc("/join", join)
http.ListenAndServe(":8080", nil)
}
client.go:
import "net/http"
http.Get("127.0.0.1:8080/join")