我是 Golang 的新手,我确实设置了一个“hello world!” 在我们的 VPS 上测试 Golang API 的消息。它在http://www.example.com:8080/hello上工作得很好。不过,我想转到 HTTPS。
有人可以逐步告诉我从 HTTP 到 HTTPS 的 golang API 的正确程序吗?谢谢!
如果 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))
}
蝴蝶不菲
慕桂英546537
相关分类