<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Web 框架 - 标签 - 研发日志 · R&amp;D Log</title><link>https://rd163.visword.com/tags/web-%E6%A1%86%E6%9E%B6/</link><description>Web 框架 - 标签 - 研发日志 · R&amp;D Log</description><generator>Hugo -- gohugo.io</generator><language>zh-CN</language><managingEditor>whutluohui@gmail.com (小智晖)</managingEditor><webMaster>whutluohui@gmail.com (小智晖)</webMaster><copyright>本作品采用知识共享署名-非商业性使用 4.0 国际许可协议进行许可。</copyright><lastBuildDate>Sun, 12 Jan 2025 00:00:00 +0800</lastBuildDate><atom:link href="https://rd163.visword.com/tags/web-%E6%A1%86%E6%9E%B6/" rel="self" type="application/rss+xml"/><item><title>Gin 开发后台服务最佳实践</title><link>https://rd163.visword.com/posts/best-practice-for-gin/</link><pubDate>Sun, 12 Jan 2025 00:00:00 +0800</pubDate><author><name>小智晖</name></author><guid>https://rd163.visword.com/posts/best-practice-for-gin/</guid><description><![CDATA[<p><a href="https://github.com/gin-gonic/gin" target="_blank" rel="noopener noreferrer">gin</a> 是一个由 Go 语言实现的 HTTP Web 框架，基于 httprouter，主打高性能与简洁的 API 设计，常用于构建 REST API 与微服务。</p>
<p><a href="https://github.com/skyhee/gin-doc-cn" target="_blank" rel="noopener noreferrer">gin 中文文档</a> 系统介绍了路由、无缝重启、中间件、数据库接入等常用方法，可作为入门与速查参考。</p>]]></description></item><item><title>Golang web框架</title><link>https://rd163.visword.com/posts/golang-web-framework/</link><pubDate>Sun, 12 Jan 2025 00:00:00 +0800</pubDate><author><name>小智晖</name></author><guid>https://rd163.visword.com/posts/golang-web-framework/</guid><description><![CDATA[<h2 id="fiber" class="headerLink">
    <a href="#fiber" class="header-mark"></a>Fiber</h2><ul>
<li><a href="https://github.com/gofiber/fiber" target="_blank" rel="noopener noreferrer">Fiber</a>:受 Express.js 启发的 Go Web 框架，底层基于 fasthttp，主打零内存分配与高性能。</li>
</ul>
<p>基于 Fiber 的开源项目:</p>
<ul>
<li><a href="https://github.com/Finb/bark-server" target="_blank" rel="noopener noreferrer">bark-server</a>:iOS 推送通知服务 Bark 的后端。</li>
</ul>
<h2 id="macaron" class="headerLink">
    <a href="#macaron" class="header-mark"></a>Macaron</h2><ul>
<li><a href="https://github.com/go-macaron/macaron" target="_blank" rel="noopener noreferrer">Macaron</a>:高生产力、模块化的 Go Web 框架。目前已进入维护模式，不再新增功能，官方推荐其后继者 <a href="https://github.com/flamego/flamego" target="_blank" rel="noopener noreferrer">Flamego</a>。</li>
</ul>
<h2 id="beego" class="headerLink">
    <a href="#beego" class="header-mark"></a>Beego</h2><ul>
<li><a href="https://github.com/beego/beego" target="_blank" rel="noopener noreferrer">Beego</a>:老牌高性能 Go Web 框架，提供 ORM、缓存、日志、配置、任务等一整套模块。注：原作者仓库 <code>astaxie/beego</code> 已迁移至 <code>beego/beego</code> 组织，请使用新地址。</li>
</ul>
<h2 id="gin" class="headerLink">
    <a href="#gin" class="header-mark"></a>Gin</h2><ul>
<li><a href="https://github.com/gin-gonic/gin" target="_blank" rel="noopener noreferrer">Gin</a>:使用最广泛的 Go Web 框架，采用 httprouter 改造的路由，性能高、API 简洁，中间件生态丰富。</li>
</ul>
<h2 id="echo" class="headerLink">
    <a href="#echo" class="header-mark"></a>Echo</h2><ul>
<li><a href="https://github.com/labstack/echo" target="_blank" rel="noopener noreferrer">Echo</a>:高性能、极简的 Go Web 框架，自动 TLS、HTTP/2、可扩展中间件支持完善。</li>
</ul>
<h2 id="chi" class="headerLink">
    <a href="#chi" class="header-mark"></a>Chi</h2><ul>
<li><a href="https://github.com/go-chi/chi" target="_blank" rel="noopener noreferrer">chi</a>:轻量、兼容 <code>net/http</code> 的路由库，API 与标准库无缝衔接，适合构建可组合的 HTTP 服务。</li>
</ul>
<h2 id="gorilla" class="headerLink">
    <a href="#gorilla" class="header-mark"></a>Gorilla</h2><ul>
<li><a href="https://github.com/gorilla/mux" target="_blank" rel="noopener noreferrer">gorilla/mux</a>:强大的 HTTP 路由与请求匹配器，功能丰富。Gorilla 工具集曾在 2022 年底被归档，后由新的维护者团队接管并恢复维护。</li>
<li><a href="https://github.com/gorilla/websocket" target="_blank" rel="noopener noreferrer">gorilla/websocket</a>:Go 社区应用最广泛的 WebSocket 库。</li>
</ul>
<h2 id="fasthttp" class="headerLink">
    <a href="#fasthttp" class="header-mark"></a>fasthttp</h2><ul>
<li><a href="https://github.com/valyala/fasthttp" target="_blank" rel="noopener noreferrer">fasthttp</a>:为极端性能优化的 HTTP 实现，吞吐量与内存占用均显著优于标准库 <code>net/http</code>,但 API 与 <code>net/http</code> 不兼容。</li>
</ul>
<h2 id="httprouter" class="headerLink">
    <a href="#httprouter" class="header-mark"></a>httprouter</h2><ul>
<li><a href="https://github.com/julienschmidt/httprouter" target="_blank" rel="noopener noreferrer">httprouter</a>:基于 radix tree 的高性能路由，是众多 Go Web 框架（含 Gin）的底层路由原型。</li>
</ul>
<h2 id="hertz" class="headerLink">
    <a href="#hertz" class="header-mark"></a>Hertz</h2><p>Hertz(发音 [həːts],赫兹)是字节跳动开源的 Golang 微服务 HTTP 框架，由 <a href="https://github.com/cloudwego" target="_blank" rel="noopener noreferrer">CloudWeGo</a> 社区维护。它最初 fork 自 fasthttp，在设计上参考了 Gin、Echo 等开源框架的优势，并结合字节跳动内部对高性能与可扩展性的诉求进行了重构与演进。其默认网络库使用 CloudWeGo 自研的 <a href="https://github.com/cloudwego/netpoll" target="_blank" rel="noopener noreferrer">Netpoll</a>(基于 epoll),并保留了切换至 Go 标准网络库的能力，具有高易用性、高性能、高扩展性等特点，目前在字节跳动内部已大规模使用。</p>]]></description></item></channel></rss>