codegangsta / gin

Live reload utility for Go web servers
MIT License
4.23k stars 317 forks source link

error while access to url localhost:8080 #152

Open 15520528 opened 5 years ago

15520528 commented 5 years ago

i got those error while access to url localhost:8080

2019/03/01 16:34:17 http: proxy error: dial tcp 127.0.0.1:3001: connect: connection refused

here my code

func handler(w http.ResponseWriter, r *http.Request) {
    fmt.Fprintf(w, "Hi there, I love %s!", r.URL.Path[1:])
}

func StartService() {
    http.HandleFunc("/", handler)
    log.Fatal(http.ListenAndServe(":8080", nil))
}
2pd commented 5 years ago

go -i run main.go try this

wrunk commented 4 years ago

you mean gin -i ....? Using the -i option helped for me

kluevandrew commented 3 years ago

you mean gin -i ....? Using the -i option helped for me

Confirm. In my case gin -i --appPort 8080 --port 3000 run main.go is useful

mcshaman commented 4 months ago

I ran into this issue as well. Found that if you put the --appPort flag after the run . then it will use the default flag i.e 3001. So as long as I put run . or run main.go at the end of the command everything worked as expected.