Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
package main
import "net/http"
import "fmt"
import "log"
var visistsCounter uint64 = 0;
func updateVisitsCounter () uint64 {
visistsCounter++
return visistsCounter
}
func main () {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
var counter uint64 = updateVisitsCounter()
fmt.Fprintf(w, "Hello, you're visitor #%d", counter)
})
log.Fatal(http.ListenAndServe(":8080", nil))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.