The World Cup is in full swing and While watching the Brazil v Chile game yesterday I figured I would play around with the unofficial World Cup API. You know the saying "if you don't use it, you lose it"? Well, it seems very true for me when it comes to coding. It seems like I have to constantly re-teach myself things when I don't code for a month or so. On with the fun.
Of course, I'm not much for PowerShell so I wanted to create a small rails application. After a few hours of work and doing some twitter bootstrap formatting I had a pretty snazzy little site. It's a simple rails application that only uses the VC part of the MVC concept. No database is necessary. The application will display 3 columns. Top Goal Scorers by individual and team, and who's playing next. When the cup is over, the third column will display the final match results and the World Cup Winner. As you would expect, the page will change as goal counts and matches proceed with the API changes.
Since I'm getting on the Cloud Foundry bandwagon, that's where I wanted to deploy it. With a simple cf push --command 'bundle exec rails s -p $PORT' I had my webapp running at http://worldcupstats.cfapps.io/.
The updated code is all available on Github at https://github.com/kacole2/Simple-World-Cup-Stats.
Here are the only two bits of interesting code if you're wondering how it's all done:
I ended up moving the application to Heroku. I was spending $7/month to host this application at PivotalCF and Heroku allows me to do it for free. The new link is now at http://simpleworldcupstats.herokuapp.com/