← Каталог
Go для микросервисов — Практические примеры реализации
Фрагмент из «Go для микросервисов»: Практические примеры реализации.
package main
import (
"fmt"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, World!")
}
func main() {
http.HandleFunc("/", handler)
fmt.Println("Starting server on :8080")
http.ListenAndServe(":8080", nil)
} package main
import (
"fmt"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, World!")
}
func main() {
http.HandleFunc("/", handler)
fmt.Println("Starting server on :8080")
http.ListenAndServe(":8080", nil)
}