Intern — Junior
¿Tiene experiencia trabajando con el protocolo HTTP?
sobes.tech AI
Respuesta de la IA
Sí, la biblioteca estándar de Go proporciona el paquete net/http, que permite crear servidores y clientes HTTP. Por ejemplo, se puede levantar rápidamente un servidor HTTP simple:
package main
import (
"fmt"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "¡Hola, HTTP!")
}
func main() {
http.HandleFunc("/", handler)
http.ListenAndServe(":8080", nil)
}
También se pueden hacer solicitudes HTTP usando http.Get o crear solicitudes más complejas con http.Client. Esto permite interactuar con APIs REST y otros servicios web.