Sunday 4 October 2020

golang 13 simple web app 2

 package main

import (
"fmt"
"net/http"
)

func index_handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, `<h1>Hey there</h1>
<p>Go is fast!</p>
<p>...and simple!</p>`)
}

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


reference:

No comments:

Post a Comment