<p>I've been learning Go recently and decided to create a small web API as an exercise project.</p>
<p>The result is a small RESTful web API that allows you to create/delete room objects inside a house object and request specific resources. It uses an SQLite database to store data.</p>
<p>I'm assuming this could be useful to newcomers learning about APIs and Go. I tried to keep things as simple as possible.</p>
<p><a href="https://github.com/dchmie01/simple_restful_api">https://github.com/dchmie01/simple_restful_api</a></p>
<p>I will try to update the project as I learn more about Go.</p>
<hr/>**评论:**<br/><br/>thewhitetulip: <pre><p>This is a good idea, it'd be great if you build some app which people would use, in their private capacity, there is no bigger joy than building some tool and sharing it with others :)</p>
<p>Self promotion:
Anyone who is new to Go and wants to build webapps also can read my book, <a href="https://github.com/thewhitetulip/web-dev-golang-anti-textbook">https://github.com/thewhitetulip/web-dev-golang-anti-textbook</a>. Thank you!</p></pre>codesenberg: <pre><p>I suggest you to check out <a href="https://github.com/alecthomas/gometalinter" rel="nofollow">gometalinter</a>.</p></pre>mariiats: <pre><p>Thanks a lot for this!</p></pre>Stuck_In_the_Matrix: <pre><p>Great work. Do you know if Go will scale with multiple connections? I've been looking at Golang as a replacement for Perl to handle my API. Is there a setting that is used to handle up to X simultaneous connections or does it just scale automatically?</p>
<p>Thanks!</p></pre>beknowly: <pre><p>Each connection is spawned in a concurrent goroutine, and goroutines are collectively multiplexed onto OS threads. If <code>runtime.GOMAXPROCS == 4</code>, any number of goroutines will be multiplexed across 4 OS threads.</p>
<p>So yes, new connections will automatically scale, and will run in multiple threads - by default. This is essentially the core use case of Go, it is very strong in this area.</p></pre>Stuck_In_the_Matrix: <pre><p>Thanks! Have you played with it in this regard and gotten a feel for how powerful it is compared to Python / Perl? I'm assuming it's going to be a magnitude or two more efficient for things like this?</p></pre>Zikes: <pre><p>In most real world scenarios, Go will be much faster for most tasks. It has a significant advantage over Python and Perl because it is compiled, though Python and Perl can eke ahead on certain tasks like JSON (de)serialization due to having highly optimized low-level libraries. I'm confident Go will close that gap before long, though.</p>
<p>I think the biggest advantage of Go over Python and Perl are 1) first-class concurrency 2) channels, to easily communicate over and synchronize threads 3) strong typing 4) great tooling out of the box (though debugging still has a ways to go) and 5) the most comprehensive standard library I've seen.</p>
<p>Have a look at <a href="http://gobyexample.com" rel="nofollow">http://gobyexample.com</a>, It showcases many of the language's better features.</p></pre>Stuck_In_the_Matrix: <pre><p>Thanks! </p></pre>-entropy: <pre><p>Are there relatively up to date benchmarks with Go and other common languages for web services? I've seen a few, but they were old. I'd love to see how Go fares in comparison to Node, or Java, and across tasks (JSON serialization, fetching from data stores, etc) </p></pre>Zikes: <pre><p><a href="https://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=go&lang2=node" rel="nofollow">https://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=go&lang2=node</a></p>
<p>At the bottom of the page are links to compare against other languages.</p></pre>beknowly: <pre><p>I couldn't say for Perl, never tried it. It should be far more efficient than python, and not too much extra complexity in writing programs.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传