package main import ( "encoding/json" "log" "net/http" ) type Response struct { Message string `json:"message"` } func handler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") response := Response{Message: "ok"} json.NewEncoder(w).Encode(response) } func main() { http.HandleFunc("/", handler) log.Println("Сервер запущен на http://localhost:8080") log.Fatal(http.ListenAndServe(":8080", nil)) }