You may also want to take a look at beego (https://github.com/astaxie/beego). It introduces a lot of workflow features on top of routing. Also, you may have an easier time with it if you can read Chinese.
Articles on Go web frameworks all end up at the same conclusion. The Go standard library is so strong around web servers it's hard to recommend anything else.
It's not entirely that simple. The problem isn't that net/http is so amazing that it's silly to replace it; it's that the replacements aren't yet up to the challenge --- by which I mean, none of them are yet so much of a win that the cost of losing compatibility with net/http outweighs the benefits.
Writing full-featured web apps in Golang in 2015 is still a lot like writing a Sinatra app was 8 years ago. It feels great at first, but you quickly realize that you're just building a half-assed version of Rails.
That's cool. I bet they could reduce it to 0.15 servers by rewriting it in C.
They probably would have drastically reduced the number of servers even if the rewrite was still in ruby, having much better understanding around the runtime requirements.
Ruby also seems like a questionable choice in the first place for such a service. Perhaps a prototype.
Nobody is pretending that MRI Ruby is the most performant runtime you can find, but that's just not an issue for 99% of web stacks.
> The Go standard library is so strong around web servers it's hard to recommend anything else.
The http packages provides the bare minimum. A serious app requires way more features than what is provided,a router than handles route variables, a middleware stack, a proper context, a proper session mechanism if one writes a website...
So it's normal people write their own libraries on top of it ( like mine @ gopkg.in/interactiv/expresso.v0 ,still alpha )
It complements Gorilla context. It's not a replacement because it doesn't solve the context problem for middleware (no way to pass net/context from middleware to your handler code).
It's not very much code (only ~90 lines inc. comments), but I think it establishes a pattern that makes everything very straightforward from authentication to logging to runtime analysis. Plays very nicely with gorilla. I think the more you let net/http shine, the better.
I'm still kind of on the fence about this. I like a lot of the choices Modl makes as a fork of Gorp, but it has significantly fewer users, particularly in the case of e.g. modl-migrate vs. sql-migrate.
27 comments
[ 3.1 ms ] story [ 38.8 ms ] threadWriting full-featured web apps in Golang in 2015 is still a lot like writing a Sinatra app was 8 years ago. It feels great at first, but you quickly realize that you're just building a half-assed version of Rails.
I've never been a fan of full-fledged frameworks and prefer the more pragmatic method of only pulling in components that I need though.
They probably would have drastically reduced the number of servers even if the rewrite was still in ruby, having much better understanding around the runtime requirements.
Ruby also seems like a questionable choice in the first place for such a service. Perhaps a prototype.
Nobody is pretending that MRI Ruby is the most performant runtime you can find, but that's just not an issue for 99% of web stacks.
The http packages provides the bare minimum. A serious app requires way more features than what is provided,a router than handles route variables, a middleware stack, a proper context, a proper session mechanism if one writes a website...
So it's normal people write their own libraries on top of it ( like mine @ gopkg.in/interactiv/expresso.v0 ,still alpha )
There's heaps of them, but the major one that strikes me is Negroni.
https://github.com/justinas/alice
It's not very much code (only ~90 lines inc. comments), but I think it establishes a pattern that makes everything very straightforward from authentication to logging to runtime analysis. Plays very nicely with gorilla. I think the more you let net/http shine, the better.
https://ant0ine.github.io/go-json-rest/
Gorilla is useful, but more for its range of standalone components than as a framework.
https://github.com/gorilla
Then you'll want database-related packages like redigo and gorp.
https://github.com/garyburd/redigo
https://github.com/go-gorp/gorp
https://github.com/emicklei/go-restful