5 ms·
Does Go have a defacto web framework?
by sergiotapia 14y ago
Does Go have a defacto web framework?
- voidlogic 14y agoMany of the people in the Go community are anti-framework and pro-library. (inversion of control; a library is provided code called by your code, versus a Framework provided code that calls your code). That being said, right now the dominate Go web library is "net/http" from the Go standard library, supplemented by Gorilla (as needed): http://www.gorillatoolkit.org/ http://www.gorillatoolkit.org/ If what you are looking for is really a Go web framework however, there are a few in development including Revel: http://robfig.github.io/revel/ http://robfig.github.io/revel/
- lelandbatey 14y agoI would love to know about this as well. Basically a basic rundown of how Go works in relation to running various web facing stuff (a simple API for example).
- genwin 14y agoSee http://golang.org/doc/articles/wiki/ http://golang.org/doc/articles/wiki/ for a starting point.
- speg 14y agoI've seen Gorilla (http://www.gorillatoolkit.org/ http://www.gorillatoolkit.org/) used quite a bit. The standard library is also good enough for small and quick things.
- elithrar 14y ago> Does Go have a defacto web framework? There's a few, but I think it's still too early to really call out a "defacto" framework. Revel, as mentioned, is a popular "full stack" framework, but it can be pretty heavy. web.go[1] gets a lot of use (it sits at a Flask/Sinatra level), and beego[5] looks good but it's also totally acceptable to plug a few libraries together without much work on top. For example, I'm using: - mux, sessions, schema & context from Gorilla[2] - go.auth for social sign-in [3] - the RethinkDB driver [4] ... and that's about it. Write your routes with mux, set up your handlers with auth/sessions/schema, and generate your models & queries with whatever DB you want. The standard html/template library is good enough (and there's a Mustache library if you need it), and the standard http library covers everything in between. TL;DR: If you enjoy writing Flask/Sinatra apps, you'll enjoy writing Go web apps. If you're coming from a full-stack framework (like me), there is definitely a learning curve, but I feel that Go's documentation and std. lib flatten that out a little. [1]: https://github.com/hoisie/web https://github.com/hoisie/web [2]: http://www.gorillatoolkit.org/ http://www.gorillatoolkit.org/ [3]: https://github.com/bradrydzewski/go.auth https://github.com/bradrydzewski/go.auth [4]: https://github.com/christopherhesse/rethinkgo https://github.com/christopherhesse/rethinkgo [5]: https://github.com/astaxie/beego https://github.com/astaxie/beego
- orangethirty 14y agoSpot on. I suggest to newcomers that they save od your coment. It is good intro to the Go biome.
- russellbeattie 14y agoWhen you said Revel is "heavy" - did you mean slow, uses lots of memory/CPU/other or just has lots of custom bits to learn/use?
- elithrar 14y ago> When you said Revel is "heavy" [...] It provides nearly everything, likely including things you don't even need. It's likely that a lot of the parts included won't be needed by a "typical" web application, and if you want to do things another way you'll need to spend some time switching those components out. To be fair though, having "everything" can be a big plus, especially when you don't know what you might need (or have the time to glue things together). I don't know how tightly coupled the components are in Revel, but if it's like Django, some things are easy to add/remove (middleware), and others are much harder to work around (ORM, views, etc.).
- human_error 14y agoweb.go is influenced from web.py.
- nteon 14y agoI've written a small production web project and several medium-sized personal projects in Go, and have not yet found a need for a web framework outside of net/http. I've used several libraries that work as nested/stacked handlers under net/http; Go's structure embedding is a natural fit for that.