How to choose a multiplexer

blov · · 379 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Hi, so I&#39;m starting a new project which will contain a GraphQL API. I&#39;m about to choose the multiplexer now and have three candidates on my plate which would all work well IMHO. Performance is not a criterium here IMHO, they seem to be all decent here. Some criteria for me are maintainability and that the project is alive.</p> <p><strong><a href="https://github.com/go-zoo/bone" rel="nofollow">https://github.com/go-zoo/bone</a></strong></p> <p>Just discovered this. Selling point: Faster than the others. But it is still quite new.</p> <p><strong><a href="https://github.com/gorilla/mux" rel="nofollow">https://github.com/gorilla/mux</a></strong></p> <p>Seeing this very often.</p> <p><strong><a href="https://github.com/julienschmidt/httprouter" rel="nofollow">https://github.com/julienschmidt/httprouter</a></strong></p> <p>So far my goto choice in other projects.</p> <hr/> <p>Do you have thoughts here? Is there an option I haven&#39;t looked at yet?</p> <hr/> <p>Options from the comments:</p> <p><strong><a href="https://github.com/go-chi/chi" rel="nofollow">https://github.com/go-chi/chi</a></strong></p> <p>I like it that they rank maintainability and developer productivity higher than performance.</p> <p><strong><a href="https://github.com/avelino/awesome-go#routers" rel="nofollow">https://github.com/avelino/awesome-go#routers</a></strong></p> <p>A nice list of available routers.</p> <hr/>**评论:**<br/><br/>adelowo: <pre><p>You should take a look at <a href="https://github.com/go-chi/chi" rel="nofollow">https://github.com/go-chi/chi</a> ... </p></pre>philiplb: <pre><p>Thank you. Ok, why? :) So far, I like:</p> <blockquote> <p>The key considerations of chi&#39;s design are: project structure, maintainability, standard http handlers (stdlib-only), developer productivity, and deconstructing a large system into many small parts.</p> </blockquote></pre>tdewolff: <pre><p>Thanks for bringing up GraphQL, that is exactly what I was looking for!</p> <p>I have been switching between a couple of multiplexers, see also <a href="https://github.com/avelino/awesome-go#routers" rel="nofollow">https://github.com/avelino/awesome-go#routers</a> for a more complete list. My own experience is that I dislike frameworks, they never seem to play nice with other packages that I want to use. Replacing <code>http.Handler</code> is a big no-no for me. In that respect I like <code>httprouter</code>, but <code>chi</code> looks nice too. At the end of the day, if it works it works. Just go with whatever you feel comfortable with.</p></pre>philiplb: <pre><p>I totally agree with the frameworks. This way, it is very easy to switch multiplexers if the requirements change.</p></pre>shovelpost: <pre><p>Any reason you have rejected the standard library multiplexer?</p></pre>philiplb: <pre><p>Just the feeling of needing convinient URL-Parameters.</p></pre>snippet2: <pre><p>Why not <a href="https://go-macaron.com" rel="nofollow">https://go-macaron.com</a> actually has really nice json control and uses others middleware. It&#39;s more of a framework then a package. I also like the multiple method routes.</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

379 次点击  
加入收藏 微博
0 回复
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传