So I stumbled around for some time before figuring out the ‘hello world’ tutorial for backbonejs but since it took me more time than expected, I decided to write one myself. The docs are great but are too mind-boggling for a newbie, especially ones who rarely venture into client side frameworks.
As I mentioned, this tutorial wont show you much apart from getting a very very basic backbonejs example working. The code is available on github HERE. I’ve used THIS project as the base. It provides the framework for a basic nodejs-express-twitterbootstrap-jade application but that’s just optional. I have also added a single page version of the code in the repository HERE. This will work equally well in a single page html with required scripts. On top it, i’ve added backbonejs and underscorejs libraries and I was good to go.
The process being followed is something like this :
1. Show button
2. attach handlers
3. invoke action on user input(after button click)
4. show the user input on page… easy peasy
Edit the ‘views/index.jade’ file to add a button and an ‘ul’(list) element.
Now create a new .js file in ‘public/js/main.js’ and include it in ‘views/index.jade’ so … Read the rest