Any good open source Go API/web projects?

polaris · · 1098 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Go is pretty good for creating web APIs. Are there any projects to learn best practices for creating web APIs.</p> <p>Update: A quick search on github showed me <a href=""></a> .It seem pretty great, it is more of a boilerplate but good enough for me. </p> <hr/>**评论:**<br/><br/>NotFromReddit: <pre><p>Not based on Go, there there is a book called <a href="">APIs You Won&#39;t Hate</a>. It&#39;s about API design.</p></pre>chilladx: <pre><p>Not exactly a Go project, but nice reading when designing an API: <a href="" rel="nofollow"></a>. And this post on building an API with gRPC, in Go: <a href="" rel="nofollow"></a></p></pre>Mittalmailbox: <pre><p>I dont understand advantages of gRPC really. Is it supposed to be used for microservices only or it has other advantages also.</p></pre>chilladx: <pre><p>(note: I&#39;m talking about gRPC with protobuf) First of all, I like the code generation. Not only you build a server, but also you generate the code for the client, and all that just by describing your messages and services. I also love the fact I don&#39;t need to handle serialization and deserialization of data (so boring when building an API, and so prone to errors). It&#39;s pretty cool to enjoy HTTP/2 server (think streaming). I like the ease to integrate authentication at the transport level. And building a full server with encryption (SSL), identification (with gRPC metadata), (de)serialization of data with just a few lines of code. And should one client be incompatible with gRPC, you can have a gateway to a REST interface pretty quickly too.</p> <p>So, imho, gRPC works perfectly for microservices, but not only. It really depends on the client, I would say, but there too, there&#39;s room for it. </p></pre>Thaxll: <pre><p>You have a real contract between the client and the server, in REST it&#39;s like oops I added this field now the API is broken, or how do I parse the response ect ... You have the same schema for talking and it&#39;s very powerful.</p></pre>HectorJ: <pre><p>There is openAPI for REST contracts</p></pre>10gistic: <pre><p>Serialization efficiency is one of the huge advantages. You describe your message types and gRPC builds binary encoders/decoders that are much faster to serialize/deserialize from/to native memory than, e.g., JSON strings</p> <p>On top of that, client generation and server stub generation makes cross-language support a little easier, and gives you familiar types for whatever language you&#39;re using. In this way, you get a little more reusability for mostly free as long as you&#39;re using supported languages.</p> <p>There are probably a few more benefits, like circuit breakers in the generated code, but in my opinion, the above two are the major selling points that interest me.</p></pre>cirowrc: <pre><p>I&#39;d stick with something like swagger / OpenAPI nowadays. <a href="" rel="nofollow">go-swagger</a> does a pretty good job of generating both client and server code from a swagger specification.</p> <p>The idea is that you create a <code>api.yml</code> file that you declaratively describe the responses and endpoints of your application and then let <code>go-swagger</code> generate the boilerplate for you. For the server-side code all you gotta do is implement the methods that the interface generated by <code>go-swagger</code> gives you and then you&#39;re done. </p> <p>Let me know if you need more info. I&#39;ve used it once and it really liked.</p></pre>diegobernardes: <pre><p>This is a project i&#39;m working on: <a href="" rel="nofollow"></a> It&#39;s heavy inspired by <a href="" rel="nofollow"></a> and <a href="" rel="nofollow"></a></p></pre>Probotect0r: <pre><p>To add on to this question, are there any go libraries that take care of setting up basic crud operations for you? I mean all the way from the rest endpoints to the database code.</p> <p>I tried go for a project once and it was fun to use, but having to write all that basic code for all projects seemed tedious. For example, I work with Java and Spring at work and I can set up a full crud API in a couple of lines of code with it.</p></pre>monkey-go-code: <pre><p>I use C# at work. So when I went to learn golang I tried to apply the same things. Basically I have a controller for each set of end points. A component for application logic and a repository layer for actual database access. That pattern works pretty good for me. I’ve heard of people copying the patterns they used in Ruby too. </p></pre>ChiefDetektor: <pre><p>portainer (<a href="" rel="nofollow"></a>) is open source. It&#39;s an webfrontend for docker. Might be interesting for u. </p></pre>brokedown: <pre><p>If you don&#39;t mind an opinionated stack, you might look at Buffalo. <a href="" rel="nofollow"></a></p> <p>I&#39;ve watched part of the video and it seems like it does bring some value, but haven&#39;t gotten beyond basic dabbling.</p></pre>applicativefunctor: <pre><p>By definition, since it has to be written in go, no.</p></pre>

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

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