Book Image

Backbone.js Essentials

By : Jeremy Walker
Book Image

Backbone.js Essentials

By: Jeremy Walker

Overview of this book

<p>This book offers insight into creating and maintaining dynamic Backbone.js web applications. It delves into the the fundamentals of Backbone.js and helps you achieve mastery of the Backbone library.</p> <p>Starting with Models and Collections, you'll learn how to simplify client-side data management and easily transmit data to and from your server. Next, you'll learn to use Views and Routers to facilitate DOM manipulation and URL control so that your visitors can navigate your entire site without ever leaving the first HTML page. Finally, you'll learn how to combine those building blocks with other tools to achieve high-performance, testable, and maintainable web applications.</p>
Table of Contents (20 chapters)
Backbone.js Essentials
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Trailing slashes


Before we move on from routes there is one last detail worth mentioning: trailing slashes. Normally web developers don't need to think about trailing slashes, because most web servers treat foo and foo/ the same. Technically however they are different, and Backbone treats them as such, which means that a route of foo will not be triggered when the user navigates to foo/.

Luckily this can easily be solved if you are using routing strings by adding (/) to the end of each string. If you are using regular expressions you can achieve a similar effect by adding \/? to the end of each of your regular expressions. However, if you are using simple strings you will either need to define two separate routes (foo and foo/), or you will just need to be careful never to create any links to foo/.