A Back-End for Backbone.js Apps

2 minute read Published

Using Ruby, Sinatra and MongoDB on Windows to create a UI back-end.

After writing about Developing Web Apps on Windows with Vagrant spent some time immersing myself in Ruby and Ruby Gems. Tonight, while catching up on some articles in my Pocket, I ran across the following article from Addy Osmani: Building Backbone.js Apps With Ruby, Sinatra, MongoDB and Haml.

Sweet. In addition to Addy's very awesome and open-source book  Backbone Fundamentals, he's also writing some useful related articles. And though I'd likely ditch haml in favor of  Emblem with  Swag, Addy's article ought to be a good starting point for the Ruby newbie.

Building on my “you can do this on Windows too” mantra as of late, I also want to point out that, to get the linked tutorial to work correctly on Ubuntu running in a virtual machine on Windows using Vagrant, you need to configure Sinatra to bind to the server on ip (and not just so that Vagrant will be able to port-forward from Windows to WEBrick onto the Ubuntu guest machine, like:

require 'sinatra'

# Listen on all interfaces in the development environment
set :bind, ''

get '/' do
   "Hello World! Is it " + settings.bind + " you're looking for?"

Here's a screen-shot of the port-forwarded response from WEBrick for Sinatra in Chrome for Windows, a back-end for Backbone apps using Ruby:

Sinatra back-end response shown in browser window

Ledger Nano X - The secure hardware wallet