Skip to content

Instantly share code, notes, and snippets.

@helinwang
Created June 17, 2014 13:49
Show Gist options
  • Save helinwang/ea9a2e88f20278d2cb53 to your computer and use it in GitHub Desktop.
Save helinwang/ea9a2e88f20278d2cb53 to your computer and use it in GitHub Desktop.
golang https server
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)
}
}
@tonyyang-svail
Copy link

OMG. Helin had at least four years of experience in Golang...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment