- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhttps-server.go
More file actions
Latest commit
19 lines (16 loc) · 412 Bytes
/
Copy pathhttps-server.go
File metadata and controls
19 lines (16 loc) · 412 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package main
import (
"log"
"net/http"
)
funchandler(w http.ResponseWriter, r*http.Request) {
w.Header().Set("Content-Type", "text/plain")
w.Write([]byte("Hi, This is an example of https server in golang!\n"))
}
funcmain() {
http.HandleFunc("/", handler)
err:=http.ListenAndServeTLS(":4433", "localhost+3.pem", "localhost+3-key.pem", nil)
iferr!=nil {
log.Fatal("ListenAndServe: ", err)
}
}