Saturday, 3 October 2020

golang 12 simple web app

 package main

import (
"fmt"
"net/http"
)

func index_handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Whoa, Go is neat")
}

func main() {
http.HandleFunc("/", index_handler)
http.ListenAndServe(":8000", nil)
}

reference:


No comments:

Post a Comment