I am looking at ways that I can build a web front-end for a system I am going to develop at work. Basically, I want to have a number of web services that will provide the data and then write a front end in html and java script to consume these services and display the data to a user.
In the end I chose Sinatra, a DSL for quickly creating web applications in Ruby with minimal effort. It is stupidly easy to create a web application! For example:
1 2 3 4
Will return “Hello World!” when you go to http://localhost:4567/hi. I used the ROXML gem to squirt out an xml representation of a ruby object and I had a web service in around 30 lines of ruby.
So I had my web service up and running. Now to consume it… As I’ve mentioned before, I like bootstrap as it is really easy to write a good looking interface without having to know loads of CSS. HTML is ok, but it can look a bit of a mess, so I decided to use Haml. It gets transformed into html, but it makes your markup look beautiful. Using it you have to go out of your way to write nasty html. Indentation is significant (a la python) so you have to right it neatly!
All in all, I’m pretty pleased with the results. None of it is earth shattering, but the progress bars are pretty neat and I like the way I’ve built the results table.
If you want to see the code, you can clone it using git