Start up
1.1 Server HTTP Pertama
package main
import (
"fmt"
"log"
"net/http"
)
func main() {
handler := http.HandlerFunc(helloworld)
if err := http.ListenAndServe("0.0.0.0:9000", handler); err != nil {
log.Fatalf("error: listening and serving: %s", err)
}
}
func helloworld(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Hello World!")
}1.2 Konfigurasi Server dengan Struct http.Server
1.3 Menjalankan Server Secara Asinkron
Ringkasan Bab 1
Last updated