当前位置: 首页 > wzjs >正文

网站首页设计素材建设部网站怎么查询企业业绩

网站首页设计素材,建设部网站怎么查询企业业绩,网站备案复查 手机号码打不通,网站建设与管理的现状内容不多,只有部分笔记,剩下的没有继续学下去,包括路由与处理器、日志中间件、请求上下文 文章目录 1、go-zero核心库1.1 路由与处理器1.2 日志中间件1.3 请求上下文 1、go-zero核心库 1.1 路由与处理器 package mainimport ("github…

内容不多,只有部分笔记,剩下的没有继续学下去,包括路由与处理器、日志中间件、请求上下文

文章目录

  • 1、go-zero核心库
    • 1.1 路由与处理器
    • 1.2 日志中间件
    • 1.3 请求上下文

1、go-zero核心库

1.1 路由与处理器

package mainimport ("github.com/zeromicro/go-zero/rest""net/http"
)func main() {r := rest.MustNewServer(rest.RestConf{Port: 8080, // 设置监听端口})defer r.Stop()// 定义一个处理器r.AddRoute(rest.Route{Method:  http.MethodGet,Path:    "/hello",Handler: helloHandler,})r.Start()
}// helloHandler 是处理 GET 请求的函数
func helloHandler(w http.ResponseWriter, r *http.Request) {w.Write([]byte("Hello, Go-zero!"))
}

1.2 日志中间件

package mainimport ("fmt""github.com/zeromicro/go-zero/rest""net/http"
)func main() {fmt.Println("http://127.0.0.1:8081/hello")r := rest.MustNewServer(rest.RestConf{Port: 8081,})defer r.Stop()// 使用中间件来记录请求日志r.Use(logMiddleware)r.AddRoute(rest.Route{Method:  http.MethodGet,Path:    "/hello",Handler: helloHandler,})r.Start()
}func logMiddleware(next http.HandlerFunc) http.HandlerFunc {return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {fmt.Printf("Received request: %s %s\n", r.Method, r.URL.Path)next.ServeHTTP(w, r)})
}// helloHandler 处理 GET 请求
func helloHandler(w http.ResponseWriter, r *http.Request) {w.Write([]byte("Hello, Go-zero!"))
}

1.3 请求上下文

package mainimport ("fmt""github.com/zeromicro/go-zero/rest""net/http"
)func main() {r := rest.MustNewServer(rest.RestConf{Port: 8080,})defer r.Stop()r.AddRoute(rest.Route{Method:  http.MethodGet,Path:    "/hello",Handler: helloHandler,})r.Start()
}func helloHandler(w http.ResponseWriter, r *http.Request) {user := r.Context().Value("user")if user != nil {fmt.Fprintf(w, "Hello, %s!", user)} else {fmt.Fprintf(w, "Hello, %s!", r.FormValue("name"))}}

API模式生成器、RPC(远程过程调用)、服务治理、持久化层(数据层)、配置与日志、定时任务、监控与报警、微服务架构支持


文章转载自:

http://Kum5EF2Y.nLgmr.cn
http://fGGgSg2H.nLgmr.cn
http://uo98BCCS.nLgmr.cn
http://aSLCNfQo.nLgmr.cn
http://ttPnv8xd.nLgmr.cn
http://2PdNVv7P.nLgmr.cn
http://YwF7FjEc.nLgmr.cn
http://FxGvdpI7.nLgmr.cn
http://fDmc6cST.nLgmr.cn
http://6QaD7gwt.nLgmr.cn
http://F84Im62m.nLgmr.cn
http://6Gcm2jD9.nLgmr.cn
http://cfhym3gA.nLgmr.cn
http://76JNL7Ug.nLgmr.cn
http://xE9b6WmC.nLgmr.cn
http://Ho0VCwUe.nLgmr.cn
http://dPW0UUNl.nLgmr.cn
http://05ldO8PB.nLgmr.cn
http://k5lwgNmx.nLgmr.cn
http://gz0GMYFe.nLgmr.cn
http://F0Jxosgn.nLgmr.cn
http://sVYnD4jL.nLgmr.cn
http://Gm1Sc8Qy.nLgmr.cn
http://c7Gs3eVL.nLgmr.cn
http://E43Tckqt.nLgmr.cn
http://jHrJpBOl.nLgmr.cn
http://qQUcMNN2.nLgmr.cn
http://IL7xoX1D.nLgmr.cn
http://rXK01XiW.nLgmr.cn
http://k5W0vFSS.nLgmr.cn
http://www.dtcms.com/wzjs/658693.html

相关文章:

  • 免费注册个网站企业建设网站目的
  • 百度推广和网站建设推广的区别长沙网页制作模板
  • 网站内链建设方法做网站用什么语言制作最安全
  • 郑州网站建设的公司学校户网站建设方案
  • 算卦网站哪里可以做网站截流做cpa
  • 公司展厅设计策划旺道seo推广系统怎么收费
  • 把网站生成app的免费平台积分支付 WordPress
  • 温州门户网站建设wordpress 网站投票
  • 网站虚拟主持人制作网站建设公司湖南
  • 描述一下网站建设的基本流程图网站免费正能量直接进入app
  • 安徽城乡建设局网站360搜索怎么做网站优化
  • 建设菠菜网站wordpress笑话主题模板
  • 美食电子商务网站建设规划书网站免费申请注册
  • 网站开发框架 Wordpresswordpress打不开了
  • 宾馆网站建设方案wordpress怎么玩
  • 外贸商城网站资质网站备案一般多久
  • dz多语言企业网站asp网站建设外文参考文献
  • 一个网站开发团队要什么人泉州优化公司
  • 湖北广域建设管理有限公司网站珠宝网站建设需求
  • 网站注册登录东莞网站建设网络公司排名
  • 做网站重庆开发公司完工后的维修账务处理
  • 网站建设 永灿 竞争昆明软件公司有哪些
  • 环保网站 源码淘宝客建立网站
  • 什么是网站挂马网站建设推广ppt
  • 网站建设编写代码问题深圳的知名网站设计有哪些
  • 网站建设 软件开发石家庄seo网络推广
  • 网站换空间不换域名对seo有影响吗商标设计图片
  • 昆山市建设工程检测中心网站企业电话卡
  • 巴中公司网站建设莱芜网站优化招聘网
  • 北京东站阿坝州城乡建设网站