Recommended Web Framework for Go

xuanbao · · 443 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Hey everyone, I&#39;m working with Go in the last two years, build infrastructures products and in love with this language. </p> <p>These days I working on a new project that will involve typical web development stuff and I don&#39;t have any experience with web development with Go. So I&#39;m looking for the right tools that will do the job and keep me productive. But, at the same time, have a web server that performs well on a large scale.</p> <p>Here&#39;s some of the things that I need for my project - ORM (including migration), validation (params, querystring, etc..), OAuth2, HTML templates (most of the code won&#39;t use it, but I need a basic template engine. maybe <code>html/template</code> is good enough for this case).</p> <p>I guess there are many gophers here that have a rich Go background with web development and can help me with that.</p> <p>I searched a bit and I found several options: <code>go-swagger</code> and <code>gobuffalo</code> and more...<br/> <code>go-swagger</code> looks good for most of the validation and the routing that I need, but it doesn&#39;t have a database integration like ORM (Maybe I can use an external one) - Anyone can share his feedback about <code>go-swagger</code>? productivity? performance?<br/> <code>gobuffalo</code> looks a bit more extensive, but I didn&#39;t hear about it before. Do you guys have any experience with it? (performance is also important since we have a large scale)<br/> What about the others? <code>beego</code>, <code>revel</code>, <code>gin</code>?</p> <p>Thanks for the help everyone! </p> <hr/>**评论:**<br/><br/>adampresley: <pre><p>I usually use Echo (<a href="https://echo.labstack.com" rel="nofollow">https://echo.labstack.com</a>). Pretty simple and covers a lot of bases. It doesn&#39;t cover ORM, and I never really use them, but I have heard of GORM (as mentioned by ozkarmg below).</p></pre>tuxlinuxien: <pre><p>+1 echo</p></pre>michele: <pre><p>I’ve been using echo for the past year and a half and it has never let me down: it strikes a good balance between simplicity and convenience.</p></pre>how_do_i_land: <pre><p>I&#39;ve been using Echo for the last month and it gives you a good framework to use when you want, and allows you to easily add custom middleware where you need it.</p></pre>albatr0s: <pre><p>Just the good old standard library plus some supporting libraries when required.</p></pre>trastentrasten: <pre><p>Have a look at Chi.</p></pre>rottenanon: <pre><p>You could also take a look here <a href="https://github.com/avelino/awesome-go" rel="nofollow">https://github.com/avelino/awesome-go</a></p></pre>no1youknowz: <pre><p>I ported an app from Gin to Echo because it could handle complex routes. It&#39;s very easy to develop with Echo, the code is very readable as well. So if you don&#39;t know how to do something specific, it&#39;s easy to find.</p> <p>I actually think not having an ORM is a major benefit. I&#39;m happier writing out my SQL queries by hand, as I have more flexibility when it comes to the complex ones. I&#39;m a DBA as well.</p> <p>If you are looking for a framework with an ORM, I was very impressed with Mark Bates&#39; Buffalo. You should check that out.</p></pre>ozkarmg: <pre><p>I can only recomend gorm (<a href="https://github.com/jinzhu/gorm" rel="nofollow">https://github.com/jinzhu/gorm</a>) wich has an excellent auto migration feature, as i usually just run the stdlib stack.</p></pre>beowulf_71: <pre><p>GORM is the one I see a lot of people mention for ORM in Go.</p> <p>go-swagger is a tool developed at VMware and made available for everyone. As I worked with some of those that built this, I can tell you this is pretty solid. However, I do not know if it builds a server side component or not.. but it uses SWAGGER API spec (or OpenAPI 2.0 spec) to define a server side API that is then called by a web UI like a ReactJS web client with AJAX requests. The most common server side Rest/API framework I see is GorillaMUX. It is more a router for incoming URLs, but works well with handling REST calls. It is similar to using something like Spring MVC or JAXRS on the Java server side of things. You would tie in mux handlers with GORM code to get a sort of JEE like setup, although not quite as robust but from what I have read capable enough to be used in place of Java and JEE... though it runs a lot faster and scales better at the expense of a lack of JEE like capabilities which may or may not matter anyway.</p></pre>kamaleshbn: <pre><p>You could check mine,<a href="https://github.com/bnkamalesh/webgo" rel="nofollow">WebGo</a>. It sticks to standard library signature and a minimalistic framework. </p></pre>lion_rouge: <pre><p>Think twice before doing webdev in Go. If you know Python and your company is not Google or doing anything that requires really high performance than you should better not use Go. Polymorphism in Go is nonexistent and you will need a lot of it. All those JSON, HTML-form, SQL parser libraries are reflect all the way down or they have a LISP interpreter written in Go interfaces. I tried doing generic webdev in Go and I regret it.</p> <p>And most of the libraries you would use for that are beta and have a number of issues. There only a couple of ORMs in Go and they just cannot be compared with SQLAlchemy, for example. </p></pre>Dedustern: <pre><p>If you need any sort of high performance concurrency, Go beats Python easily. Python does a lot of things well, concurrency just isn&#39;t one of them</p></pre>lion_rouge: <pre><p>If is the keyword</p></pre>Dedustern: <pre><p>Yeah. Go isn&#39;t a very good choice for generic web development, I do agree.</p></pre>lion_rouge: <pre><p>I would even dare to say Typescript (i.e. Node and some Vue.js) or Clojure+Clojurescript (or re-frame library) are superior for web development as they don&#39;t divide backend and frontend.</p></pre>lion_rouge: <pre><p>99% of ordinary webdev is IO from browser to database and reverse. If you use Go your data structures will consist of struct tags more than 50%.</p></pre>

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

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