Intern — Junior
Have you had experience working with the HTTP protocol?
sobes.tech AI
Answer from AI
Yes, the Go standard library provides the net/http package, which allows you to create HTTP servers and clients. For example, you can quickly set up a simple HTTP server:
package main
import (
"fmt"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, HTTP!")
}
func main() {
http.HandleFunc("/", handler)
http.ListenAndServe(":8080", nil)
}
You can also make HTTP requests using http.Get or create more complex requests with http.Client. This allows interaction with REST APIs and other web services.