我是刚来Golang的新手,我建立了一个"你好,世界!"在我们的VPS上测试Golang API的消息.http://www.example.com:8080/hello点的时候就可以了.不过,我想转到HTTPS.
有人能告诉我golang API从HTTP到HTTPS的正确步骤吗?非常感谢.
如果golang代码存在问题:
package main
import (
"fmt"
"log"
"net/http"
)
func main() {
http.HandleFunc("/hello", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, World")
})
fmt.Println("Server Started On Port 8080")
log.Fatal(http.ListenAndServe(":8080", nil))
}