Book Image

Backbone.js Blueprints

By : Andrew Burgess
Book Image

Backbone.js Blueprints

By: Andrew Burgess

Overview of this book

<p>Backbone.js is an open source, JavaScript library that helps you to build sophisticated and structured web apps. It's important to have well-organized frontend code for easy maintenance and extendability. With the Backbone framework, you'll be able to build applications that are a breeze to manage.<br /><br />In this book, you will discover how to build seven complete web applications from scratch. You'll learn how to use all the components of the Backbone framework individually, and how to use them together to create fully featured applications. In addition, you'll also learn how Backbone thinks so you can leverage it to write the most efficient frontend JavaScript code.<br /><br />Through this book, you will learn to write good server-side JavaScript to support your frontend applications. This easy-to-follow guide is packed with projects, code, and solid explanations that will give you the confidence to write your own web applications from scratch.</p>
Table of Contents (14 chapters)
Backbone.js Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Adding the public folder


Since Backbone is a frontend library, it's something we'll need to be serving to the client. We've set up our Express app to statically serve the files in our public directory, and added several script tags to the index.ejs file, but we haven't created these things yet.

So, create a directory named public in your project directory. Now download the latest versions of Underscore (http://underscorejs.org), Backbone (http://backbonejs.org), and jQuery (http://jquery.com) and put them in this folder. It's very likely that newer versions of these libraries have come out since this book was written. Since updates to these projects could change the way they work, it's best to stick to the following versions:

  • Backbone: Version 1.1.2

  • Underscore: Version 1.6.0

  • jQuery: Version 2.0.3

I will mention here that we're including Underscore and jQuery because Backbone depends on them. Actually, it only really depends on Underscore, but including jQuery does give us a few extra features that we'll be happy to have. If you need to support older versions of Internet Explorer, you'll also want to include the json2.js library (https://github.com/douglascrockford/JSON-js), and switch to a version of jQuery 1 (jQuery 2 doesn't support older versions of IE).

Note

Everything up to this point will be the same for each of the applications we are going to build in this book. In the downloaded files for this book, you can start each chapter by copying the template folder and working from there.