Revel or Beego?

xuanbao · · 3619 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Hi, i&#39;m new in go and i&#39;ll start a new web project (it&#39;s a personal initiative) and i want use go lang. I would use a go framework to build a rest API layer. Do you used revel or beego? which one do you think that is better? Any recommendation? My biggest concern is the life time and maintenance of the chosen framework.</p> <hr/>**评论:**<br/><br/>ledongthuc: <pre><p>Gorillatoolkit or Gin. REST API just don&#39;t need heavy webapp fullpage as Revel or Beego.</p></pre>ZenSwordArts: <pre><p>No matter what you will choose in the end.. keep in mind that all frameworks based on httprouter (gin is one of them) have a serious <a href="https://github.com/julienschmidt/httprouter/issues/73" rel="nofollow">restriction</a>.</p> <p>Some people will tell you it&#39;s bad API design if you run into this issue but IMO it&#39;s just an unnecessary limitation.. and if you have a big API project you will certainly run into this issue.</p></pre>beertocode: <pre><p>When I started with go, I actually used revel. It does have some nice tools provided (e.g. dev mode, where it will recompile changes immediately and formats JSON outputs nicely etc.), but in the long run I was hitting some problems.</p> <p>The compile binary is bloating up really quick, a simple API only with REST on postgresql and one or two background workers compiled to 100mb of binary. Revel has it&#39;s own testing framework. I liked it in the beginning, as it provides a UI interface for running tests. Later I realize that I don&#39;t really need it, moreover this testing framework does not provide coverage reports!</p> <p>Please note that I haven&#39;t worked with revel for about a year. There might have been changes in between.</p></pre>interactiv_: <pre><p>If you&#39;re biggest concern is life time and maintenance then don&#39;t use a framework you wont be willing to maintain yourself. </p> <p>There are no real frameworks in Go anyway, an http router is not a web framework .</p></pre>masterwujiang: <pre><p>I don&#39;t think using Go to write a Rails style web application is a good idea. You will miss many components already existing in Rails, for me it is Cookie Session.</p> <p>A better way is to write pure API back-end in Go and use React/Elm/Om in front-end.</p></pre>redditter15: <pre><p>Gin has a session middleware that use cookies like Rails.</p> <p>I usually disagree with the statement &#34;use just the standard library&#34;, some libraries like Gin and Gorm do great abstractions, saving time, and with the right setup you have a mini-Rails.</p> <p>Keep away from Beego, Revel and like, though.</p> <p>My 2 cents.</p></pre>s-expression: <pre><blockquote> <p>Gin has a session middleware that use cookies like Rails.</p> </blockquote> <p>It&#39;s just a wrapper around Gorilla sessions, which also pulls in Gorilla context, which is annoying since Gin already has its own solution for the request-context problem.</p> <p>So even &#34;not a framework&#34; frameworks end up bloated in the end.</p></pre>ferossi: <pre><p>And what framework do you recommend yo build a pure API backend?</p></pre>arcagenis: <pre><p>I would give a try to <a href="https://github.com/pressly/chi" rel="nofollow">Chi</a> because of the inclusion of net/context in Golang 1.7</p> <p>Works well here</p></pre>s-expression: <pre><p>If you&#39;re actually interested in forward compatibility with the Context inclusion in 1.7, then you should avoid Chi since it uses a nonstandard handler signature.</p> <p>The context will be part of the request parameter, not passed in as its own argument.</p></pre>arcagenis: <pre><p>Actually I use the <a href="https://github.com/pressly/chi/tree/v2" rel="nofollow">v2</a> with the standard http.Handler signature and Golang 1.7beta</p></pre>s-expression: <pre><p>Well that&#39;s pretty cool, thanks</p></pre>masterwujiang: <pre><p>I am seeking too, my company uses gorilla/mux, but it&#39;s painful especially in unit tests.</p> <p>If gin has resolved <a href="https://github.com/gin-gonic/gin/issues/155" rel="nofollow">swagger issue</a>, I would recommend it.</p> <p>I believe Swagger/RAML is a good description of contract between microservices and contract between frontends and backends, so I value good support of Swagger/RAML. I have tried <a href="https://github.com/goadesign/goa" rel="nofollow">goa</a>, but I can&#39;t remember why I discontinued with it.</p></pre>Chuiken: <pre><p><a href="https://github.com/Jumpscale/go-raml" rel="nofollow">https://github.com/Jumpscale/go-raml</a> ;-)</p> <ul> <li>go generate from raml files. generates Gorilla Muxer for routing<br/></li> <li>Still in active development RAML-1.0<br/></li> <li>Also generates Python</li> </ul></pre>tmornini: <pre><p>This!</p></pre>im7mortal: <pre><p>There already was a topic about web frameworks <a href="https://www.reddit.com/r/golang/comments/42krm2/echo_or_which_framework_should_i_use/" rel="nofollow">https://www.reddit.com/r/golang/comments/42krm2/echo_or_which_framework_should_i_use/</a></p></pre>ferossi: <pre><p>Thanks!</p></pre>novikk: <pre><p>Beego is very easy to grasp and does things <em>the Go way</em>. It also provides enough functionalities so that you do not need to search for other projects or implement them on your own (routing, session management, ORM (although I prefer gorm), flash messages, caching, configuration...).</p> <p>In the end there might be better alternatives (there are better loggers than the one that comes with Beego, there are better cron projects than the one Beego provides...) but all in all it is pretty good and as I said it&#39;s very easy to learn.</p> <p>We use it in our company for most of our projects and keep sending contributions to improve it even more!</p></pre>UnknownTed: <pre><p>my personal preference is <a href="https://github.com/labstack/echo" rel="nofollow">echo</a> because if you need better speed out of it you can change the engine to fasthttp</p></pre>3Dayo: <pre><p>Ive tried gin, and while its good, echo feels more idomatic and somewhat easier to reason about, which is why i recommend echo when im asked about go web frameworks</p></pre>FPSports: <pre><p>Yeah, i&#39;ve looked at several frameworks including revel and beego ... and i can +1 this. Echo seems to be very cool. I&#39;m coming from PHP (Symfony2 mostly) ..... and i&#39;m very pleased so far. I&#39;m using echo in a combination with quicktemplate!</p></pre>robvdl: <pre><p>Don&#39;t use Revel, I tried it a long time ago when first starting out, didn&#39;t like it, it uses it&#39;s own build pipeline rather than using &#34;go build&#34; which kind of rubbed me the wrong way. I know there is someone out there who forked Revel to fix all it&#39;s &#34;quirks&#34; but I forgot the repo. Anyway, Gin or Echo are always a good choices. Beego probably isn&#39;t all bad either, but you probably want to start with something lighter like Gin or Echo.</p> <p>A list of frameworks I stay away from: Revel, Martini, Iris.</p></pre>da_rob: <pre><p>Fixing Revel&#39;s quirks? You&#39;re probably talking about <a href="https://github.com/roblillack/mars" rel="nofollow">Mars</a>.</p></pre>kaeshiwaza: <pre><p>With your concern of life time and maintenance, like most of us, just use the standard library !</p> <p>Maybe if you really need it sometimes you will use a toolkit for routing like gorilla. </p> <p>For middleware often it&#39;s easier to do it alone than take time to see how others do.</p> <p>Go std lib is still improving in this direction, adding context to request in 1.7 for example.</p></pre>

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

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