gin
gin copied to clipboard
error while access to url localhost:8080
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))
}
go -i run main.go
try this
you mean gin -i ....
? Using the -i option helped for me
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
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.