lean into examples
This commit is contained in:
17
examples/https-servers/https-servers.go
Normal file
17
examples/https-servers/https-servers.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package main
|
||||
|
||||
import "net/http"
|
||||
|
||||
func handler(res http.ResponseWriter, req *http.Request) {
|
||||
res.Header().Set("Content-Type", "text/plain")
|
||||
res.Write([]byte("Hello from HTTPS\n"))
|
||||
}
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/", handler)
|
||||
err := http.ListenAndServeTLS(":5000",
|
||||
"/tmp/server.crt", "/tmp/server.key", nil)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user