Ai
1 Star 0 Fork 0

lorock/goconfig

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.go 553 Bytes
一键复制 编辑 原始数据 按行查看 历史
lorock 提交于 2020-11-21 16:42 +08:00 . 代码优化
package main
import (
"log"
"net/http"
"os"
"gitee.com/lorock/goconfig"
"github.com/fvbock/endless"
"github.com/gorilla/mux"
)
func handler(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("WORLD!"))
}
func main() {
// 配置初始化
goconfig.Init()
port := goconfig.GetString("APP_SERVER_PORT")
mux1 := mux.NewRouter()
mux1.HandleFunc("/hello", handler).
Methods("GET")
err := endless.ListenAndServe("0.0.0.0:"+port, mux1)
if err != nil {
log.Println(err)
}
log.Println("Server on" + port + " stopped")
os.Exit(0)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/lorock/goconfig.git
git@gitee.com:lorock/goconfig.git
lorock
goconfig
goconfig
v0.0.9

搜索帮助