The _______ method of the http package is used to create a new HTTP server.

  • CreateServer
  • ListenAndServe
  • NewServer
  • Serve
The correct answer is ListenAndServe. This method creates a new HTTP server and sets it to listen on the specified network address. It starts accepting incoming connections and serving HTTP requests. It takes in an address and a handler, allowing you to specify the network address to listen on and the handler to use to handle requests. This method is commonly used to start serving HTTP traffic in Go applications.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *