YAM (Yet Another Mux)

agolangf · · 633 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>YAM is our first Go project we thought others might find useful. </p> <p>It&#39;s http serve mux which will hopefully make it easy to define routes and handlers for your http applications.</p> <p>It&#39;s features include:</p> <ul> <li>405 handling</li> <li>Easy sub routing</li> <li>Simple pattern matching (pat style)</li> <li>Configurable if you don&#39;t like default implementations</li> <li>Doesn&#39;t break net/http convention</li> </ul> <p>Keen to see what you guys think and feedbacks always welcome :)</p> <p><a href="https://github.com/thisissoon/yam" rel="nofollow">https://github.com/thisissoon/yam</a></p> <p><a href="https://godoc.org/github.com/thisissoon/yam" rel="nofollow">https://godoc.org/github.com/thisissoon/yam</a></p> <hr/>**评论:**<br/><br/>lantins: <pre><p>I&#39;ve had a look, but I&#39;m not seeing anything that &#39;sells me&#39; on why I should try using YAM vs. another mux? Could you let us know what YOU think the main reason is? :)</p></pre>krak3n_: <pre><p>We build a lot of REST APIs @ SOON_ and we have been tinkering with Go here and there and decided to try and use it for one of our smaller services for an upcoming project.</p> <p>We didn&#39;t want to go with a full blown Web framework, that would be like using a nuke to hit a pin head so we had a look around for some mux&#39;s that would give us the routing requirements we needed. We evaluated a few:</p> <p>Gorilla Mux Pat Routes</p> <p>All of which are nice projects but didn&#39;t give us what we wanted.</p> <p>In gorilla mux out of the box there is no 405 handling (<a href="https://github.com/gorilla/mux/issues/6" rel="nofollow">https://github.com/gorilla/mux/issues/6</a>), it 404&#39;s, which might be fine for some. Sub Routing in Gorilla is also a bit of a pain, mostly due to this issue: <a href="https://github.com/gorilla/mux/issues/31" rel="nofollow">https://github.com/gorilla/mux/issues/31</a>.</p> <p>Pat and Routes are great (and YAM is inspired by them) but don&#39;t (as far as I could see) provide sub routing so you can break up your routes into sensible packages to nicely modularise and organise your code.</p> <p>So for those reasons above we decided to write YAM to fix those problems and give us a mux that has a simple API but flexible enough to not enforce convention onto the developer.</p> <p>The godocs has a few examples but maybe I should update the readme with some nice cool examples and maybe even provide some example apps.</p> <p>Edit: Spelling / Grammer</p></pre>lantins: <pre><p>Thank you! :)</p></pre>robvdl: <pre><p>hmm, a bit unrelated, I was going to say that icon doesn&#39;t look like a YAM, that&#39;s a Kumara! (in NZ it is anyway) However it turns out that New Zealand yams are different (I didn&#39;t know this). Googling &#34;yam&#34; vs &#34;yam nz&#34; has different images.</p></pre>krak3n_: <pre><p>ha, happy to change it for an image that more accurately resembles a yam :)</p></pre>robvdl: <pre><p>There&#39;s no need the image looks great. in NZ we just have a different kind of YAMs, they are very nice fried in butter or oil, or some people bake them, or have them with a roast :)</p></pre>

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

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