Go Lang backend

agolangf · · 698 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>What are all the projects that you are using in your go backend? There are many projects in github just for authentication that it&#39;s a bit difficult to choose one.</p> <hr/>**评论:**<br/><br/>goomba_gibbon: <pre><p>This question is very broad. Can you be more specific about your needs? Are you looking specifically for an authentication package?</p></pre>vyasgiridhar: <pre><p>Not just for authentication. I am curious about what router, authentication, rpc packages people are using since there are wide variety of choices available.</p></pre>bear1728: <pre><p>Here is what I am using in a project currently:</p> <ul> <li><a href="https://github.com/julienschmidt/httprouter" rel="nofollow">router</a></li> <li><a href="https://auth0.com" rel="nofollow">authentication</a></li> <li><a href="https://github.com/powerman/rpc-codec/tree/master/jsonrpc2" rel="nofollow">jsonrpc2</a> (the json rpc code in net/rpc/jsonrpc is for v1 I think)</li> </ul> <p>I would definitely start small, first write hello world and then move forward. You may not even need a web framework, most simple things can be done with straight-forward middle ware like <a href="https://medium.com/@matryer/writing-middleware-in-golang-and-how-go-makes-it-so-much-fun-4375c1246e81#.74wefnhwp" rel="nofollow">this</a> or using contexts.</p></pre>robvdl: <pre><p>If you are using Go 1.7 you might want to checkout Chi instead of httprouter as it scores a bit better here <a href="https://github.com/diyan/go-web-framework-comparsion" rel="nofollow">https://github.com/diyan/go-web-framework-comparsion</a> with no thumbs-down on any points.</p> <p>httprouter is fine, but it doesn&#39;t really have a middleware stack, which they then suggest using gorilla/handlers for, which leads to at least 2 dependencies needed instead of 1 if using Chi, but that&#39;s just my 2c.</p> <p>Both should perform about the same with lots of routes, as both are based on a patricia radix trie.</p> <p>I&#39;m all into libraries that don&#39;t have any external dependencies of their own, makes managing my dependencies a lot easier.</p> <p>Edit: For authentication, I know there is authboss which might be easiest to go with for now... Personally I have just done authentication myself using bcrypt for password hashing, Gorilla sessions for managing the session and a simple session and auth middleware of my own.</p></pre>bear1728: <pre><p>That&#39;s a good point, I haven&#39;t seen Chi. I like how it already has the graceful shutdown built in, I was using <a href="http://gopkg.in/tylerb/graceful.v1" rel="nofollow">graceful</a>. I&#39;ll definitely look into Chi. We only have 3~4 middlewares (auth, logging, errors) and I just wrote them using net/http, I didn&#39;t need gorilla. It seems like really very little of our code would change switching to Chi, just changing how parameters from the url are passed.</p> <p>I totally agree about the external dependencies. I actually made a graph of all our dependencies with <a href="https://github.com/hirokidaichi/goviz" rel="nofollow">goviz</a>. It would be cool to have more tools like this, maybe a output a nice webpage with SVG or something, skipping the need for external dependencies like <code>graphviz</code> :p</p> <p>Also I have to say that I usually don&#39;t recomend people do authentication yourself in that way. I think more people should be using &#34;sign in with ____&#34;. These really aren&#39;t that complicated to do and I think it is nicer for the end user. Our previous server did authentication through google this way. But I totally understand there are use-cases for this.</p></pre>jmatosp: <pre><p>Welcome to Golang!</p> <p>Start small write only what you need, in go it will be less effort and code then it looks like.</p></pre>

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

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