Skip to content

Instantly share code, notes, and snippets.

@pei0804
Created July 5, 2019 07:11
Show Gist options
  • Select an option

  • Save pei0804/a2f6aac4a4da47d223b98dfc9993ec7d to your computer and use it in GitHub Desktop.

Select an option

Save pei0804/a2f6aac4a4da47d223b98dfc9993ec7d to your computer and use it in GitHub Desktop.

Revisions

  1. pei0804 created this gist Jul 5, 2019.
    18 changes: 18 additions & 0 deletions handle.go
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    package main

    import (
    "fmt"
    "log"
    "net/http"
    )

    type simpleHandler struct{}

    func (h *simpleHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
    fmt.Fprint(w, "hello")
    }

    func main() {
    http.Handle("/count", new(simpleHandler))
    log.Fatal(http.ListenAndServe(":8080", nil))
    }