What’s the difference?
If I use net/http/fcgi package, every request will be executed in new goroutine. It seems to be the same for net/http ListenAndServe…isn’t it?
What advantages and disadvantages?
What’s the difference? If I use net/http/fcgi package, every request will be executed in
Share
The
net/http/fcgiallows you to listen via the FastCGI protocol for new connections whereas thenet/httpListenAndServe is there for listening for incoming http connections. With a FastCGI listener you need an http server sitting in front of the Go process that is proxying incoming connections and sending requests via FastCGI to you Go process.FastCGi can be useful if you have multiple services that you need to expose on the same port. You can run something like Apache or Nginx as the front end and expose certain urls to your Go process via FastCGI.
If this is not your case and you just want to run a Go web server on a port, stick with
net/http.