Data, Maps, Usability, and Performance
Results for tag: Go
Google App Engine is a great platform for quickly developing and hosting web applications. There are alternatives but today we are going to dig into GAE and show how simple it is to get started. I have previously made a few posts on Go and Martini so today we are going to setup Martini on Google App Engine for the Go Language in order to launch an API in the cloud. Martini is a great framework for building a RESTful API and the workflow below will take you through all the steps, from downloading GoogleAppEngine to deploying our Martini API app:
I have been working on a pretty large project with Go in the last few weeks and wanted to dedicate a blog post to various GoLang examples, demos, and resources. A tour of Go was certainly helpful in getting started and the Go Playground is very useful for quick code examples, but there are more blogs, forums, and resources that can really help when developing with the Go Language. Here is what I found helpful:
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
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