chat-backend/main.go

22 lines
449 B
Go

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