Skip to content

Instantly share code, notes, and snippets.

@tnhu
Forked from helinwang/gist:ea9a2e88f20278d2cb53
Created September 29, 2015 01:07
Show Gist options
  • Save tnhu/9766c1db1731d2275f9d to your computer and use it in GitHub Desktop.
Save tnhu/9766c1db1731d2275f9d to your computer and use it in GitHub Desktop.

Revisions

  1. @helinwang helinwang created this gist Jun 17, 2014.
    20 changes: 20 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    package main

    import (
    "net/http"
    "fmt"
    )

    func handler(w http.ResponseWriter, r *http.Request) {
    fmt.Println("Inside handler")
    fmt.Fprintf(w, "Hello world from my Go program!")
    }

    func main() {
    http.HandleFunc("/", handler)
    // create certificate check http://www.akadia.com/services/ssh_test_certificate.html
    err := http.ListenAndServeTLS("localhost:9998", "server.crt", "server.key", nil)
    if err != nil {
    fmt.Println(err)
    }
    }