chat-backend/main.go

22 lines
443 B
Go

package main
import (
"chatgpt/core"
"chatgpt/util"
"net/http"
)
// main
func main() {
util.Conf = &util.Config{}
http.HandleFunc("/", core.Handler)
addressArr := util.GetListenAddress()
if addressArr[0] == "https" {
certFile := util.Conf.Get("init", "cert_file")
keyFile := util.Conf.Get("init", "key_file")
http.ListenAndServeTLS(addressArr[1], certFile, keyFile, nil)
} else {
http.ListenAndServe(addressArr[1], nil)
}
}