
Previously, I have created a really simple web app with Go Lang and Martini that communicated with MySQL to retrieve a list of posts, an individual post, and allowed creation of a post. Now, we are going to handle updates and deletion, transform responses to use JSON for client side Ajax requests, and implement the user relation: user login, logout, managing sessions and authentication, as well as, retrieving posts by user. Supporting PUT (update) and delete requests with Ajax and JSON was pretty trivial (thanks to Martini) but evolving the app to handle users properly with good validation was much more work then I originally expected. Still, Go does make the code easy to understand and Martini contributed utilities have been a great help. Lets start.
GoLang and Martini Web Application
Read more

Last week I saw a video on the Martini web framework for Go and it inspired me to check it out. Looking at the performance of Go is even more inspiring and today I decided to learn the Go language and write a really simple app with Go, Martini, and MySQL. I started using the native SQL package for Go but quickly adopted gorp as it looks like a really clean API to talk to the database. I have also leveraged the binding and render Martini utilities to abstract more of the code out of my main go file. The app will create a table in mysql, create some sample posts, show a homepage with these posts, show an individual post view, and allow the end user to create their own post. I will also dig into error handling, validation, converting timestamps, and properly using layout template in the render utility for good SEO.
Sample Martini App
Read more