Hacker News new | comments | show | ask | jobs | submit login

I really like the look of this. There's some very clever API design going on here, and it's clearly taking advantage of Go's language features rather than just trying to be a clone of a framework from another language.

I particularly like the service injection concept. Django forces every view function to take a request object and return a response object. Flask makes these optional, but then requires you to use global variables to access more information from the request. Martini attempts to resolve any arguments it sees by looking up their static type against a service directory. I think that's really clever.

The way it allows you to stack up Handlers is neat too. Django does this with either globally applied middleware or per-view-function decorators, but there's something really neat about just taking a list of functions for things like authentication and "stacking" them on top of each other - or having that same function applied as middleware to every request using m.Use(func...). Using Context.Next() to allow that middleware to "wrap" a request (the equivalent of Django's process_request and process_response pair) is clever as well.

Colour me impressed!

> The way it allows you to stack up Handlers is neat too.

Ditto. I especially like that it's fully compatible with the existing http.HandlerFunc interface, which is a big deal. This means you can just write "regular" handlers as middleware (or bring them over from existing code) without having to reinvent the wheel.

I also very much like the way it leaves sessions up to you. A few other Go frameworks leverage http.Cookie, instead of letting you use something like gorilla/sessions. I'm a big proponent of server-side sessions (wherever possible) given how simple gorilla/sessions + Redis can be to set up.

I'm a little tempted to use this myself (I've been going mostly naked so far) for my weekend (read: also weeknight) project, given that all the "real" logic (middleware, DB queries, etc.) can be dropped in alongside it.

Yup. Making the "dropping in" part easy is partly why Martini can be kept clean on the number of dependencies it pulls in. The only external dependency on Martini is https://github.com/codegangsta/inject which I maintain anyway :)

Thanks for the feedback! I knew from the beginning that I didn't want to create another clone framework. The Golang community needs something that is in line with it's own philosophies.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact