Hacker News new | past | comments | ask | show | jobs | submit login
Build a RESTful API with Martini (0value.com)
82 points by bsg75 on Nov 28, 2013 | hide | past | web | favorite | 8 comments



Author of Martini here. It's very cool to see community members explain concepts better than I can! I'm very excited to see where the golang community can take this over time.


Interesting! I just had a quick look at the video and was looking at request params. Does martini support optional params? For example:

  m.Get("/something/:optional?"...
Something like Laravel's request parameters: http://laravel.com/docs/routing#route-parameters

or even route filters. Those would be suitable for that Auth demo, it looks like a filter, but would also be nice to have a group for routes and filter over those.


We just merged in a glob like feature for routes so you can accomplish things like route filtering or virtual servers. Eg m.Get("/hello/", ...)


Really nice. Some of the stuff happening in Go for web services is awesome.

However I would like to see someone develop a library for doing RESTful APIs that does some of the repetitiveness in implementing REST properly for you.



Wow, the simplicity of it is what amazes me.

Hopefully it matures more!

(Use cases with db, auth (oauth2), caching, frontend integration, would be nice :3)


I did a quick example with a DB. This is before they added the render middleware, so I used the native JSON marshaling to get a struct to output JSON.

https://github.com/nobleach/go-geocoder


Great explanation. I really want to see an example with map to a real database from you too!




Applications are open for YC Winter 2020

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

Search: