In Go, what function is used to start an HTTP server?
- http.Serve
- http.StartServer
- http.ListenAndServe
- http.Handle
The correct option is http.ListenAndServe. This function starts an HTTP server and accepts incoming connections on the specified address. It takes a network address as its parameter and a handler to handle requests.
Loading...
Related Quiz
- Mocking interfaces can help to isolate _____ during testing.
- How does Go handle cyclic dependencies between packages?
- What keyword is used to specify a condition in a switch statement in Go?
- You are tasked with improving the performance of a Go application. How would you use unit testing to identify and verify optimizations?
- What types of coverage does code coverage analysis typically measure?