Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Backbone.js

You're reading from   Mastering Backbone.js Design and build scalable web applications using Backbone.js

Arrow left icon
Product type Paperback
Published in Jan 2016
Publisher Packt
ISBN-13 9781783288496
Length 278 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Abiee Echamea Abiee Echamea
Author Profile Icon Abiee Echamea
Abiee Echamea
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Architecture of a Backbone application 2. Managing Views FREE CHAPTER 3. Model Bindings 4. Modular Code 5. Dealing with Files 6. Store data in the Browser 7. Build Like a Pro 8. Testing Backbone Applications 9. Deploying to Production 10. Authentication Index

CommonJS modules


In recent years, Node has been gaining popularity in the software industry; indeed it is becoming a very popular choice for backend development in a full JavaScript technology stack. If you don't know about Node, you can think about it as JavaScript used in the server instead of a browser.

Node uses the CommonJS module syntax for its modules; a CommonJS module is a file that exports a single value to be used for other modules. It is useful to use CommonJS because it provides a clean way to manage JavaScript modules and dependencies.

To support CommonJS, Node uses the require() function. With require() you can load JavaScript files without the need to use <script> tags, instead calling require() with the name of the module/dependency that you need and assigning it to a variable.

To illustrate how CommonJS modules work, let's write a Node module and see how to use the require() function. The following code shows a simple module that exposes a simple object with the method...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image