知识卡片
处理器连接请求与核心能力
HTTP处理器从Request取得方法、路径和请求体,用ResponseWriter写状态和正文;多路复用器负责选择处理器。把路由、协议转换和业务核心分开,才能在新增端点时复用同一数据能力。第三方路由器是本书时点选择,不代表当前标准库必定缺少相同功能。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Building a Cloud Native Service · 查看原书依据
The http.ResponseWriter and a *http.Request parameters can be used to construct the HTTP response and retrieve the request, respectively. We can use the http.HandleFunc function to register helloGoHandler as the handler function for any request that matches a given pattern (the root path, in this example). Once we’ve registered our handlers, we can call ListenAndServe,
参考来源
- 位置:《Cloud Native Go》第05章《Building a Cloud Native Service》(来源项目book-sources;源文件:extracted/Cloud Native Go (Matthew A. Titmus)/_epub-src/OEBPS/ch05.xhtml)
- 结论依据:HTTP处理器从Request取得方法、路径和请求体,用ResponseWriter写状态和正文;多路复用器负责选择处理器。原文相应定义、示例或限制为此结论提供依据;补充纠错与版本边界在正文就近标明。
- 原始内容:The http.ResponseWriter and a *http.Request parameters can be used to construct the HTTP response and retrieve the request, respectively. We can use the http.HandleFunc function to register helloGoHandler as the handler function for any request that matches a given pattern (the root path, in this example). Once we’ve registered our handlers, we can call ListenAndServe,