TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Goji: a web microframework for Go

239 点作者 zenazn大约 11 年前

18 条评论

tptacek大约 11 年前
This is going to sound a little dismissive, but I don&#x27;t mean it to be:<p>I&#x27;m not sure I understand the value that these frameworks offer beyond the HTTP server interface Golang supports out of the box, plus a URL router like &quot;pat&quot; (or whatever the cool kids are using now other than &quot;pat&quot;).<p>I see the clean middleware abstraction, but I find the idiomatic closure-based implementation of middleware adds only a couple extra lines of code, and in return I get total flexibility.<p>What&#x27;s this doing that I&#x27;m not seeing? I&#x27;m sure there&#x27;s something; I&#x27;m writing this comment out of ignorance.
评论 #7629731 未加载
评论 #7630116 未加载
评论 #7629688 未加载
评论 #7630874 未加载
评论 #7630392 未加载
aalpbalkan大约 11 年前
It is good to have many web microframeworks in a language ecosystem. In Python probably there are a hundred of those. Many of those are not picked up by the community –a natural selection. Only really a few of those survived. It all depends on you if you are going to choose Revel, Martini, Goji or whatever you want. Today, thousands of apps run on web.py, yet most of the source code is untouched last 3-5 years (<a href="https://github.com/webpy/webpy/tree/master/web" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;webpy&#x2F;webpy&#x2F;tree&#x2F;master&#x2F;web</a>) It&#x27;s impressive it just works!<p>Personally, I am looking for frameworks that many people rely on, maintained frequently as needed and works just fine. There could be a +-10% difference on QPS those framework URL routers can handle and render a &#x27;hello world&#x27; page.<p>So this is a nice attempt I would say, looks cleaner than Martini, still supports middlewares. On the other hand, Martini has support to serve static files, logging, panic recovery, which are also good and has a bigger fanboy community around it: <a href="https://github.com/go-martini/martini" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;go-martini&#x2F;martini</a>
评论 #7629956 未加载
kohanz大约 11 年前
Perhaps this is not the best place for this question, but as a frequent HN reader, I&#x27;m constantly told that Go is great to develop in and very performant. However, it&#x27;s not clear to me how Go suits a web application with relational data.<p>From what I&#x27;ve gleaned, an ORM does not make sense in Go, so how would this type of application be approached? Writing a lot of ORM-type boiler-plate? A completely different way? Or is Golang a bad choice for such an application?
评论 #7629770 未加载
评论 #7629749 未加载
评论 #7629777 未加载
codegangsta大约 11 年前
Looks very nice. I do appreciate having more clean, well thought out web frameworks in the Go space. Type switches for your handlers is a good way to approach the net&#x2F;http compatibility.<p>There are some people that find that Martini is a bit too magical for them, and that is completely okay. It&#x27;s great to see another minimal framework that will suit their needs.
Matrixik大约 11 年前
About this part in README:<p>&gt; I have very little interest in boosting Goji&#x27;s router&#x27;s benchmark scores. There is an obvious solution here--radix trees--and maybe if I get bored I&#x27;ll implement one for Goji, but I think the API guarantees and conceptual simplicity Goji provides are more important (all routes are attempted, one after another, until a matching route is found). Even if I choose to optimize Goji&#x27;s router, Goji&#x27;s routing semantics will not change.<p>Maybe you can just use HttpRouter without reimplementing it yourself?<p><a href="https://github.com/julienschmidt/httprouter" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;julienschmidt&#x2F;httprouter</a><p>&gt; The router is optimized for best performance and a small memory footprint. It scales well even with very long pathes and a large number of routes. A compressing dynamic trie (radix tree) structure is used for efficient matching.<p><pre><code> goji.Get(&quot;&#x2F;hello&#x2F;:name&quot;, hello) router := httprouter.New() router.GET(&quot;&#x2F;hello&#x2F;:name&quot;, Hello)</code></pre>
评论 #7632992 未加载
DennisP大约 11 年前
If you think you&#x27;re ready, it might be fun to submit a techempower benchmark.<p><a href="http://www.techempower.com/benchmarks/" rel="nofollow">http:&#x2F;&#x2F;www.techempower.com&#x2F;benchmarks&#x2F;</a>
nemothekid大约 11 年前
I see why some would call Martini &quot;magic&quot; but I&#x27;m not entirely sure I prefer having to deal with a giant `map[string]inteface{}`. What you are really doing is moving the &quot;magic&quot; from the framework and onto the developer (I now have to do type checking and casting).<p>That said I&#x27;m a huge fan of Martini and I actually use codegangsta&#x27;s Inject in my other projects to manage shared state&#x2F;resources, so I am heavily partial to it.
评论 #7632972 未加载
zkirill大约 11 年前
Great job! It definitely feels like a microframework compared to others. I&#x27;m glad that there are so many starting points for Go web services available now of varying levels complexity. To me this feels like it fills the void between Gorilla and Revel&#x2F;Martini&#x2F;Beego. Also, the code is very well documented and easy to follow.
mcescalante大约 11 年前
Every time I see a web framework for Go, I just want to see an example or two of a website developed with it. Does anybody have any solid examples?<p>Hopefully, like me, some others enjoy exploring existing code as well as reading the examples &#x2F; docs.
评论 #7630470 未加载
gkya大约 11 年前
Call it nitpicking, but I would rather not export a symbol &#x27;C&#x27; from a library I write. Seriously, is &#x27;Context&#x27; that hard to type? And the author seems to be far from lazy, the codebase is nicely and extensively commented (it is a nice read indeed). Apart from this issue, the library seems quite nice.
ya3r大约 11 年前
Do we yet have the Django for Go? Goji is as said a microframework, what I want is an equivalent of Django.
评论 #7632779 未加载
ddoolin大约 11 年前
A bit off-topic, but I love the site colors. I&#x27;d love that text theme for Atom if it&#x27;s available?
评论 #7629643 未加载
评论 #7629804 未加载
abbot2大约 11 年前
When I read things like &quot;func Get(pattern interface{}, handler interface{})&quot; I start questioning why this whole thing is ever written in Go at all? This kind of ditches half of Go&#x27;s benefits by moving all type checks to run time.
评论 #7633012 未加载
levosmetalo大约 11 年前
Just a quick look at the examples, and I can say that it reminds me very much of Clojure Ring. It provides really small and extensible core, and if the community pick it up and start writing useful middlewares, it can become very useful.
gfalcao大约 11 年前
Were you inspired by this ? <a href="http://www.cherrypy.org/" rel="nofollow">http:&#x2F;&#x2F;www.cherrypy.org&#x2F;</a> The juxtaposition of things and colors and code simplicity looks like so
tete大约 11 年前
How does this compare with Martini?<p><a href="http://martini.codegangsta.io/" rel="nofollow">http:&#x2F;&#x2F;martini.codegangsta.io&#x2F;</a>
评论 #7629884 未加载
jodiscr大约 11 年前
I ain&#x27;t switching from Perl 5.8 to golang until a shared hosting provider becomes available.
评论 #7632529 未加载
leccine大约 11 年前
Sorry for my ignorance, how is this different, better than Martini? What is the main goal of creating a new framework (instead of getting the features you are missing implemented in the currently existing ones)?
评论 #7629670 未加载
评论 #7632165 未加载
评论 #7629603 未加载
评论 #7629683 未加载
评论 #7629592 未加载