REST Layer, easy REST & GraphQL API Framework

agolangf · · 782 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>About 9 months ago I decided to start an experiment on porting the ideas of the Python Eve REST API framework in Go. If you are unfamiliar with Python Eve, the main idea that makes it different from other API frameworks is that it handles the storage for you. You can have a fully working RESTful API on top of your favorite database in a few lines of code<sup>Wconfiguration.</sup></p> <p>Python Eve is almost perfect, it has one issue though: it&#39;s not in Go :)</p> <p>After 9 months of simmering, I can say that my experiment is now a working project ready for Prime Time. It is not a real port of Python Eve as it doesn&#39;t try to maintain data compatibility. It is more a port of the concepts I liked in Eve with the addition of new ones.</p> <p>So let me introduce REST Layer (<a href="http://rest-layer.io">http://rest-layer.io</a>). It comes with storage handlers for MongoDB and ElasticSearch (more to come) and you can create your own. It implements all the best practices (I know of) like net/context, circuit breaker (via hystrix-go), structured logging etc.</p> <p>The cherry on top is that in addition to its powerful field selection and projection system, there is an experimental GraphQL support (read-only for now).</p> <p>I am excited to get your feedback.</p> <hr/>**评论:**<br/><br/>pkieltyka: <pre><p>It&#39;s strange to think of both a REST and GraphQL API framework in one project, just because GraphQL needs just a single http method and single endpoint.. if GraphQL works out, it could be the successor of REST, which I sure hope happens. But first we need a solid, clean and well functioning graphql library for Go. And who knows if the GraphQL spec itself doesn&#39;t need some time to bake further</p></pre>poitrus: <pre><p>GraphQL is just a different way to access your data. Think of REST Layer as a way to express the schema of the data you wanna expose in a generic way. The “protocol” used to expose this schema is then exchangeable.</p></pre>afghanPower: <pre><p>Well done! But isn&#39;t building a REST API and integrating it with a database already really easy without frameworks like this in Go??</p></pre>poitrus: <pre><p>You&#39;re right, Go stdlib offers everything you need to expose your database over a HTTP API. But as soon as you need to add things like input validation, partial updates (PATCH), consistency and concurrency control, caching and conditional request, field selection, embedding etc. it becomes quickly obvious that some help would be helpful.</p> <p>Most API frameworks will cover some of those needs, like data un/serialization or data validation. By understanding your data model REST Layer can make things like field selection, graph queries and data versioning very easy to add with no implementation code on developer&#39;s side.</p></pre>afghanPower: <pre><p>Thanks for taking time to reply ;) The web side of development is still quite new for me.</p></pre>z_ryad: <pre><p>Awesome work dude. Wish you the best !</p></pre>code-shoily: <pre><p>It looks really well. Keep it up! Now let me go and try it out a bit ;)</p></pre>

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

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