学院一golang公链开发
GoWeb编程web项目结构:gowebcontrollercontrollerHandler.go//处理客户端请求controllerResponse.go//响应客户端.gohtmlindex.htmllogin.htmlloginSucc.htmltemp.htmlstaticcssstyle.cssjsmain.go启动webgoweb/main.gopackagemainimport("net/http""fmt")funco(whttp.ResponseWriter,r*http.Request){fmt.Fprintf(w,"oGoWeb")}funcmain(){//1.测试gowebhttp.HandleFunc("/",o)//设置的路由err:=http.ListenAndServe(":9000",nil)//设置的端口iferr!=nil{log.Fatal("ListenAndServe:",err)}}在终端窗口进入项目中使用gobuild构建在终端窗口中执行生成的文件goweb.exe使用浏览器页面goweb/main.gopackagemainimport("net/http""fmt")funco(whttp.ResponseWriter,r*http.Request){fmt.Fprintf(w,"oGoWeb")}funcTempView(whttp.ResponseWriter,r*http.Request){page:=filepath.Join("html","temp.html")result,err:=te