admin管理员组文章数量:1559094
install the gin framework
go get -u github/gin-gonic/gin
resolve golang prompt dial tcp 172.217.160.113:443: connectex: a connection attempt failed:
go get: module github/rogpeppe/godef: get "https://proxy.golang/github/rogpeppe/godef/@v/list": dial tcp 172.217.160.113:443: connectex: a connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
solution: change it to our domestic available agent address
go env -w goproxy=https://goproxy
#create file hellodemo.go
package main
import (
"net/http"
"github/gin-gonic/gin"
)
func main() {
r := gin.default()
r.get("/hello", func(c *gin.context) {
c.json(http.statusok, gin.h{
"message": "helloworld",
})
})
r.run() // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")
}
run hellodemo.go and visit 0.0.0.0:8080/hello ("localhost:8080/hello")
go run hellodemo.go
insatll the beego framework
go get github/beego/beego/v2@latest
package main
import "github/beego/beego/v2/server/web"
func main() {
web.run()
}
build and run
go build hello.go
./hello
本文标签: domestic
j9九游会老哥俱乐部交流区的版权声明:本文标题:set up the golang domestic agent,install the gin and beego framwork 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/xitong/1727371269a1111197.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论