Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (23 sloc) 536 Bytes
// Seriál "Programovací jazyk Go"
//
// Dvanáctá část
//
// Demonstrační příklad číslo 11:
// Jednoduchý HTTPS server
package main
import (
"io"
"log"
"net/http"
)
func mainEndpoint(writer http.ResponseWriter, request *http.Request) {
writer.Header().Set("Content-Type", "text/plain")
io.WriteString(writer, "Hello world!\n")
}
func main() {
http.HandleFunc("/", mainEndpoint)
err := http.ListenAndServeTLS(":4443", "server.crt", "server.key", nil)
if err != nil {
log.Fatal("ListenAndServe: ", err)
}
}
You can’t perform that action at this time.