-
-
Save tnhu/9766c1db1731d2275f9d to your computer and use it in GitHub Desktop.
golang https server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment