7 ms·
Echo – Golang micro web framework
- InvisibleCities 11y agoCan a moderator add "Golang Web Framework" or something to the title of this article? I would imagine that most readers would assume this is about a new version of the Amazon Echo, and the current title seems almost engineered to create that confusion.
- Urgo 11y agoExactly what I thought
- BinaryIdiot 11y agoYeah same thought. Honestly Amazon announced the Echo about 4 months before this framework even became a thing. Personally think they should think about a different name, even though they're not in the same space, to make search, discovery and recognition easier.
- hacym 11y agoEcgo.
- dang 11y agoWe changed it to the title of the article, which is what the HN guidelines ask submitters to use in the first place. (Submitted title was "Introducing Echo v2 fast and highly customizable with many new features".)
- visarga 11y agoI thought it was going to be about the Amazon Echo.
- vishr 11y agoSorry for the confusion guys but now I don't have an option to edit.
- bigdubs 11y agoThis is cool! I'm actually kind of shocked it performs better than gin (which is based on httprouter). Are you using a specialized prefix tree for the routes?
- melle 11y agoI'm not sure this is the case, at least not according to the benchmarks in the gin-gonic/gin repo. This framework was submitted to HN before:https://news.ycombinator.com/item?id=9296524 https://news.ycombinator.com/item?id=9296524 In that discussion the author of gin mentions gin has a zero allocation router as well https://github.com/gin-gonic/gin/issues/249 https://github.com/gin-gonic/gin/issues/249 On mobile right now, will look at the gin/echo benchmarks later (especially if the gin benchmarks compare the fasthttp engine of echo)
- melle 11y agoLooking at https://github.com/gin-gonic/go-http-routing-benchmark/blob/master/bench_test.go https://github.com/gin-gonic/go-http-routing-benchmark/blob/... All echo benches have been commented out, last change about a year ago. Tests do not use echo's fasthttp engine.
- zokier 11y agoThat GH issue is almost exactly a year old and still open, with no recent comments.
- HeadlessChild 11y agoTerrible name.
- dang 11y agoPlease don't post snarky dismissals.
- njpatel 11y agoHave been using this for quite some time - it has a nice API and is solid in production. I love the simplicity and it's small enough a codebase to quickly read and start hacking around.
- melle 11y agoDo you have any experience with gin? If so, why do you prefer echo over gin? Thanks
- zeemonkee3 11y agoPersonally I prefer two specific things: 1) echo is more middleware compatible - it's a PITA to use a lot of "standard" Go middleware (e.g. nosurf) with Gin, but echo has no problems with these. 2) the function signature for handlers always returns an error - so you have func(Context) error rather than func(Context). This feels a bit more like idiomatic Go, and makes it easier to write generic error middleware for your app. In terms of performance, for all intents and purposes they're about the same in real-world cases (the Go community for some odd reason loves bikeshedding over router benchmarks, but in the real world this is probably the least of your concerns).
- njpatel 11y agoAgreed - those two points, and the general simplicity of the Echo codebase, were why I ended up using it over the (many) other options for Go. Honestly haven't had the desire to check anything else out since, it's just always worked very well.
- zappo2938 11y agoI use express / node. It looks like I can map what I know to this framework quite quickly. Is it worth the investment?
- sargas 11y agoHere's one way to find you my friend: prototyping. Go is simple enough that could give you a good idea of what your life will be like using a package in a "short" amount of time.
- debarshri 11y agoDoes it support templates like handlerbar or jade?
- nkozyra 11y agoWell, it supports returning a string from a handler, so ... yes. :)
- softinio 11y agoPersonally I don't think golang needs a web framework. What comes with the standard library is all that you need.
- shizcakes 11y agoWhile this is true at some level, there are certain benefits to performance tested, well-thought-out libraries that encapsulate good approaches to problems the standard library does not solve. I think the bigger problem was that it seemed like a whole bunch of folks wanted to be the one to write "the next big web framework", and they didn't really understand the value and usability of the standard library. Those frameworks are generally not necessary. Echo is not those frameworks. It's worth a look at the value it provides rather than knee-jerking "no frameworks!".
- deleted 11y ago[deleted]
- pram 11y agoAbsurd statement. For starters: the mux/router included with the standard http library isn't particularly good or performant, which is why most of these projects like gin and httprouter were started in the first place. You'd also have to roll your own middleware implementation, which means you'll end up with your own framework at some point regardless.
- sargas 11y agoStory of my life right there. The standard library will take you a long ways in web dev (specially in prototyping), but ultimately needs a lot of improvement that the community made in the form of 3rd party packages.
- dudus 11y agoGo already has a few microframeworks. What I think it needs is a fat one. It seems the idea of fat frameworks doesn't resonate well with go developers but I don't understand why. Django is the only reason I stick with python today for anything that will have more than five pages. I want form handling, security features such as XSS, CSRF baked in, debug tools such as debug-toolbar and I want to have a basic login feature done for me. Admin would be a plus but is not required. Someone needs to write a good rails/django clone for go.
- tmaly 11y agoI am still using the Go framework Gin. Echo has similar performance, but Gin was there first. I do have to code a bunch of stuff myself as opposed to Django. But if I really wanted to save time, I would just use WordPress.
- awzjmi 11y agohttp://beego.me/ http://beego.me/ is a tool mentioned in the benchmarks. it also has a large plugin and community developing behind it.
- goldbrick 11y agoGo doesn't need a fat framework. If you need a fat framework, use Rails or Django. You don't have to (re)write everything in Go, you know.
- rantanplan 11y agoUm why? Maybe you mean you don't need one? So if my language of choice is Go, you can somehow guarantee that I won't need a fat framework? How?
- konart 11y ago>So if my language of choice is Go It seems like you are trying to fit everything onto this one choice. This is never a good choice. One should chose technology or stack correcponding to the porblem needed to be solved. Not vice versa. If you need a tool such as Django - you should use one and use Go (both here are for sake of example) for some small tasks, where it can give the most. Building a new "fat" framework just because you like the langauge is kind of strange approach.
- zxv 11y agoAre there any compatible CSRF and XSS packages?