100% found this document useful (2 votes)
16 views

JavaScript Frameworks for Modern Web Dev 1st Edition Ambler Tim - Download the ebook now to never miss important content

The document provides links to various ebooks related to web development, including titles on JavaScript frameworks, web application security, and modern web development techniques. Users can explore and download these ebooks in multiple formats from textbookfull.com. Additionally, it includes information about the authors and a detailed table of contents for the book 'JavaScript Frameworks for Modern Web Dev' by Tim Ambler and Nicholas Cloud.

Uploaded by

bloshizfire
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
16 views

JavaScript Frameworks for Modern Web Dev 1st Edition Ambler Tim - Download the ebook now to never miss important content

The document provides links to various ebooks related to web development, including titles on JavaScript frameworks, web application security, and modern web development techniques. Users can explore and download these ebooks in multiple formats from textbookfull.com. Additionally, it includes information about the authors and a detailed table of contents for the book 'JavaScript Frameworks for Modern Web Dev' by Tim Ambler and Nicholas Cloud.

Uploaded by

bloshizfire
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 55

Explore the full ebook collection and download it now at textbookfull.

com

JavaScript Frameworks for Modern Web Dev 1st


Edition Ambler Tim

https://textbookfull.com/product/javascript-frameworks-for-
modern-web-dev-1st-edition-ambler-tim/

OR CLICK HERE

DOWLOAD EBOOK

Browse and Get More Ebook Downloads Instantly at https://textbookfull.com


Click here to visit textbookfull.com and download textbook now
Your digital treasures (PDF, ePub, MOBI) await
Download instantly and pick your perfect format...

Read anywhere, anytime, on any device!

Web Application Security Exploitation and Countermeasures


for Modern Web Applications 1st Edition Andrew Hoffman

https://textbookfull.com/product/web-application-security-
exploitation-and-countermeasures-for-modern-web-applications-1st-
edition-andrew-hoffman/
textbookfull.com

Web Application Security Exploitation and Countermeasures


for Modern Web Applications 1st Edition Andrew Hoffman

https://textbookfull.com/product/web-application-security-
exploitation-and-countermeasures-for-modern-web-applications-1st-
edition-andrew-hoffman-2/
textbookfull.com

JavaScript on Things: Hacking hardware for web developers


Lyza Danger Gardner

https://textbookfull.com/product/javascript-on-things-hacking-
hardware-for-web-developers-lyza-danger-gardner/

textbookfull.com

Modern Web Development on the JAMstack Modern techniques


for ultra fast sites and web applications 1st Edition
Mathias Biilmann
https://textbookfull.com/product/modern-web-development-on-the-
jamstack-modern-techniques-for-ultra-fast-sites-and-web-
applications-1st-edition-mathias-biilmann/
textbookfull.com
Learn Java for Web Development Modern Java Web Development
Layka Vishal

https://textbookfull.com/product/learn-java-for-web-development-
modern-java-web-development-layka-vishal/

textbookfull.com

JavaScript Cookbook: Programming the Web 3rd Edition Scott

https://textbookfull.com/product/javascript-cookbook-programming-the-
web-3rd-edition-scott/

textbookfull.com

PHP Web Services APIs for the Modern Web 2nd Edition Lorna
Jane Mitchell

https://textbookfull.com/product/php-web-services-apis-for-the-modern-
web-2nd-edition-lorna-jane-mitchell/

textbookfull.com

Full stack development with JHipster build full stack


applications and microservices with Spring Boot and modern
JavaScript frameworks Second Edition Sendil Kumar N.
https://textbookfull.com/product/full-stack-development-with-jhipster-
build-full-stack-applications-and-microservices-with-spring-boot-and-
modern-javascript-frameworks-second-edition-sendil-kumar-n/
textbookfull.com

Ultimate Modern jQuery for Web App Development 1st Edition


Laurence Svekis

https://textbookfull.com/product/ultimate-modern-jquery-for-web-app-
development-1st-edition-laurence-svekis/

textbookfull.com
I
Fa Ma Kn Re Grun nclu
ye ch oc q t, de
, Q , ko uir Ye s B
, A Mo ut eJ om o
sy ng , A S,B a we
nc o ng ro n, r,
.js ose ul w PM
, U , ar se 2
nd K n JS, rif ,
er ex, Kr y,
sco B ak
re, ook en
an she ,
d L lf,
od
as
h

www.it-ebooks.info
JavaScript Frameworks
for Modern Web Dev

Tim Ambler
Nicholas Cloud

www.it-ebooks.info
JavaScript Frameworks for Modern Web Dev
Copyright © 2015 by Tim Ambler and Nicholas Cloud
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the
material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation,
broadcasting, reproduction on microfilms or in any other physical way, and transmission or information
storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now
known or hereafter developed. Exempted from this legal reservation are brief excerpts in connection with
reviews or scholarly analysis or material supplied specifically for the purpose of being entered and executed
on a computer system, for exclusive use by the purchaser of the work. Duplication of this publication or
parts thereof is permitted only under the provisions of the Copyright Law of the Publisher’s location, in its
current version, and permission for use must always be obtained from Springer. Permissions for use may be
obtained through RightsLink at the Copyright Clearance Center. Violations are liable to prosecution under
the respective Copyright Law.
ISBN-13 (pbk): 978-1-4842-0663-8
ISBN-13 (electronic): 978-1-4842-0662-1
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol
with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only
in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the
trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are
not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to
proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication,
neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or
omissions that may be made. The publisher makes no warranty, express or implied, with respect to the
material contained herein.
Managing Director: Welmoed Spahr
Lead Editor: Louise Corrigan
Technical Reviewer: Robin Hawkes
Editorial Board: Steve Anglin, Mark Beckner, Gary Cornell, Louise Corrigan, James DeWolf,
Jonathan Gennick, Robert Hutchinson, Michelle Lowman, James Markham, Matthew Moodie,
Jeffrey Pepper, Douglas Pundick, Ben Renow-Clarke, Gwenan Spearing, Matt Wade, Steve Weiss
Coordinating Editor: Kevin Walter
Copy Editor: Bill McManus
Compositor: SPi Global
Indexer: SPi Global
Artist: SPi Global
Cover Designer: Crest
Distributed to the book trade worldwide by Springer Science+Business Media New York,
233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail
orders-ny@springer-sbm.com, or visit www.springeronline.com. Apress Media, LLC is a California LLC
and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc).
SSBM Finance Inc is a Delaware corporation.
For information on translations, please e-mail rights@apress.com, or visit www.apress.com.
Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use.
eBook versions and licenses are also available for most titles. For more information, reference our Special
Bulk Sales–eBook Licensing web page at www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this text is available to
readers at www.apress.com/. For detailed information about how to locate your book’s source code, go to
www.apress.com/source-code/.

www.it-ebooks.info
There was a young lady named Laura,
Who was a beautiful señora.
Her love and assurance
Was a frequent occurrence
Which allowed me to write this book for yah.
—Tim

Dedicated to Brittany who supported me and gave me space


during the long hours that writing demands.
—Nicholas

www.it-ebooks.info
Contents at a Glance

About the Authors���������������������������������������������������������������������������������������������������xix


About the Technical Reviewer��������������������������������������������������������������������������������xxi
Acknowledgments������������������������������������������������������������������������������������������������xxiii
Introduction�����������������������������������������������������������������������������������������������������������xxv


■Chapter 1: Bower��������������������������������������������������������������������������������������������������� 1

■Chapter 2: Grunt�������������������������������������������������������������������������������������������������� 11

■Chapter 3: Yeoman���������������������������������������������������������������������������������������������� 37

■Chapter 4: PM2���������������������������������������������������������������������������������������������������� 53

■Chapter 5: RequireJS������������������������������������������������������������������������������������������� 73

■Chapter 6: Browserify���������������������������������������������������������������������������������������� 101

■Chapter 7: Knockout������������������������������������������������������������������������������������������ 121

■Chapter 8: AngularJS���������������������������������������������������������������������������������������� 155

■Chapter 9: Kraken���������������������������������������������������������������������������������������������� 191

■Chapter 10: Mach���������������������������������������������������������������������������������������������� 251

■Chapter 11: Mongoose��������������������������������������������������������������������������������������� 297

■Chapter 12: Knex and Bookshelf����������������������������������������������������������������������� 345

■Chapter 13: Faye������������������������������������������������������������������������������������������������ 381

www.it-ebooks.info
■ Contents at a Glance


■Chapter 14: Q����������������������������������������������������������������������������������������������������� 395

■Chapter 15: Async.js����������������������������������������������������������������������������������������� 425

■Chapter 16: Underscore and Lodash����������������������������������������������������������������� 447

Index��������������������������������������������������������������������������������������������������������������������� 477

vi

www.it-ebooks.info
Contents

About the Authors���������������������������������������������������������������������������������������������������xix


About the Technical Reviewer��������������������������������������������������������������������������������xxi
Acknowledgments������������������������������������������������������������������������������������������������xxiii
Introduction�����������������������������������������������������������������������������������������������������������xxv


■Chapter 1: Bower��������������������������������������������������������������������������������������������������� 1
Getting Started����������������������������������������������������������������������������������������������������������������� 2
Configuring Bower������������������������������������������������������������������������������������������������������������ 2
The Manifest�������������������������������������������������������������������������������������������������������������������� 2
Creating a New Manifest������������������������������������������������������������������������������������������������������������������������ 3

Finding, Adding, and Removing Bower Packages������������������������������������������������������������ 3


Finding Packages����������������������������������������������������������������������������������������������������������������������������������� 3
Adding Packages������������������������������������������������������������������������������������������������������������������������������������ 4
Removing Packages������������������������������������������������������������������������������������������������������������������������������� 5

Semantic Versioning��������������������������������������������������������������������������������������������������������� 6
Managing the Dependency Chain������������������������������������������������������������������������������������� 7
Creating Bower Packages������������������������������������������������������������������������������������������������ 8
Choose a Valid Name������������������������������������������������������������������������������������������������������������������������������ 8
Use Semver Git Tags������������������������������������������������������������������������������������������������������������������������������� 8
Publish Your Package to the Registry����������������������������������������������������������������������������������������������������� 9

Summary�������������������������������������������������������������������������������������������������������������������������� 9

vii

www.it-ebooks.info
■ Contents


■Chapter 2: Grunt�������������������������������������������������������������������������������������������������� 11
Installing Grunt��������������������������������������������������������������������������������������������������������������� 12
How Grunt Works������������������������������������������������������������������������������������������������������������ 12
Gruntfile.js�������������������������������������������������������������������������������������������������������������������������������������������� 12
Tasks���������������������������������������������������������������������������������������������������������������������������������������������������� 14
Plugins�������������������������������������������������������������������������������������������������������������������������������������������������� 14
Configuration���������������������������������������������������������������������������������������������������������������������������������������� 15

Adding Grunt to Your Project������������������������������������������������������������������������������������������ 15


Maintaining a Sane Grunt Structure����������������������������������������������������������������������������������������������������� 15

Working with Tasks�������������������������������������������������������������������������������������������������������� 18


Managing Configuration����������������������������������������������������������������������������������������������������������������������� 18
Task Descriptions��������������������������������������������������������������������������������������������������������������������������������� 18
Asynchronous Tasks����������������������������������������������������������������������������������������������������������������������������� 19
Task Dependencies������������������������������������������������������������������������������������������������������������������������������� 20
Multi-Tasks������������������������������������������������������������������������������������������������������������������������������������������� 20
Multi-Task Options�������������������������������������������������������������������������������������������������������������������������������� 22
Configuration Templates����������������������������������������������������������������������������������������������������������������������� 23
Command-Line Options������������������������������������������������������������������������������������������������������������������������ 24
Providing Feedback������������������������������������������������������������������������������������������������������������������������������ 24
Handling Errors������������������������������������������������������������������������������������������������������������������������������������� 25

Interacting with the File System������������������������������������������������������������������������������������ 25


Source-Destination Mappings�������������������������������������������������������������������������������������������������������������� 26
Watching for File Changes�������������������������������������������������������������������������������������������������������������������� 28

Creating Plugins������������������������������������������������������������������������������������������������������������� 32
Getting Started������������������������������������������������������������������������������������������������������������������������������������� 32
Creating the Task���������������������������������������������������������������������������������������������������������������������������������� 32
Publishing to npm��������������������������������������������������������������������������������������������������������������������������������� 35

Summary������������������������������������������������������������������������������������������������������������������������ 36
Related Resources��������������������������������������������������������������������������������������������������������� 36

viii

www.it-ebooks.info
■ Contents


■Chapter 3: Yeoman���������������������������������������������������������������������������������������������� 37
Installing Yeoman����������������������������������������������������������������������������������������������������������� 38
Creating Your First Project���������������������������������������������������������������������������������������������� 38
Subcommands�������������������������������������������������������������������������������������������������������������������������������������� 41

Creating Your First Generator����������������������������������������������������������������������������������������� 42


Yeoman Generators are Node Modules������������������������������������������������������������������������������������������������ 42
Sub-Generators������������������������������������������������������������������������������������������������������������������������������������ 43
Defining Secondary Commands����������������������������������������������������������������������������������������������������������� 49
Composability��������������������������������������������������������������������������������������������������������������������������������������� 51

Summary������������������������������������������������������������������������������������������������������������������������ 52
Related Resources��������������������������������������������������������������������������������������������������������� 52

■Chapter 4: PM2���������������������������������������������������������������������������������������������������� 53
Installation���������������������������������������������������������������������������������������������������������������������� 53
Working with Processes������������������������������������������������������������������������������������������������� 54
Recovering from Errors������������������������������������������������������������������������������������������������������������������������ 56
Responding to File Changes����������������������������������������������������������������������������������������������������������������� 58

Monitoring Logs������������������������������������������������������������������������������������������������������������� 58
Monitoring Resource Usage������������������������������������������������������������������������������������������� 60
Monitoring Local Resources����������������������������������������������������������������������������������������������������������������� 60
Monitoring Remote Resources������������������������������������������������������������������������������������������������������������� 61
Advanced Process Management������������������������������������������������������������������������������������ 63
JSON Application Declarations������������������������������������������������������������������������������������������������������������� 63

Load-Balancing Across Multiple Processors������������������������������������������������������������������ 68


Zero-Downtime Deployments��������������������������������������������������������������������������������������������������������������� 70

Summary������������������������������������������������������������������������������������������������������������������������ 72
Related Resources��������������������������������������������������������������������������������������������������������� 72

ix

www.it-ebooks.info
■ Contents


■Chapter 5: RequireJS������������������������������������������������������������������������������������������� 73
Running the Examples���������������������������������������������������������������������������������������������������� 74
Working with RequireJS������������������������������������������������������������������������������������������������� 74
Installation�������������������������������������������������������������������������������������������������������������������������������������������� 75
Configuration���������������������������������������������������������������������������������������������������������������������������������������� 75
Application Modules and Dependencies����������������������������������������������������������������������������������������������� 78
Paths and Aliases��������������������������������������������������������������������������������������������������������������������������������� 81
Shims���������������������������������������������������������������������������������������������������������������������������������������������������� 84
Loader Plugins�������������������������������������������������������������������������������������������������������������������������������������� 88
Cache Busting��������������������������������������������������������������������������������������������������������������������������������������� 94

RequireJS Optimizer������������������������������������������������������������������������������������������������������� 96
Configuring r.js������������������������������������������������������������������������������������������������������������������������������������� 96
Running the r.js Command������������������������������������������������������������������������������������������������������������������� 97

Summary������������������������������������������������������������������������������������������������������������������������ 99

■Chapter 6: Browserify���������������������������������������������������������������������������������������� 101
The AMD API vs. CommonJS���������������������������������������������������������������������������������������� 102
Installing Browserify���������������������������������������������������������������������������������������������������� 102
Creating Your First Bundle�������������������������������������������������������������������������������������������� 103
Visualizing the Dependency Tree���������������������������������������������������������������������������������� 104
Creating New Bundles As Changes Occur�������������������������������������������������������������������� 105
Watching for File Changes with Grunt������������������������������������������������������������������������������������������������ 106
Watching for File Changes with Watchify������������������������������������������������������������������������������������������� 106

Using Multiple Bundles������������������������������������������������������������������������������������������������ 108


The Node Way��������������������������������������������������������������������������������������������������������������� 111
Module Resolution and the NODE_PATH Environment Variable���������������������������������������������������������� 111
Dependency Management������������������������������������������������������������������������������������������������������������������ 114

Defining Browser-Specific Modules����������������������������������������������������������������������������� 115

www.it-ebooks.info
■ Contents

Extending Browserify with Transforms������������������������������������������������������������������������� 116


brfs����������������������������������������������������������������������������������������������������������������������������������������������������� 116
folderify���������������������������������������������������������������������������������������������������������������������������������������������� 117
bulkify������������������������������������������������������������������������������������������������������������������������������������������������� 118
Browserify-Shim��������������������������������������������������������������������������������������������������������������������������������� 119

Summary���������������������������������������������������������������������������������������������������������������������� 120
Related Resources������������������������������������������������������������������������������������������������������� 120

■Chapter 7: Knockout������������������������������������������������������������������������������������������ 121
Views, Models, and View Models��������������������������������������������������������������������������������� 122
The Recipe List����������������������������������������������������������������������������������������������������������������������������������� 124
Recipe Details������������������������������������������������������������������������������������������������������������������������������������� 127

Binding View Models to the DOM��������������������������������������������������������������������������������� 129


View Models and Forms����������������������������������������������������������������������������������������������� 131
Switching to “Edit” Mode������������������������������������������������������������������������������������������������������������������� 131
Changing the Recipe Title������������������������������������������������������������������������������������������������������������������� 134
Updating Recipe Servings and Cooking Time������������������������������������������������������������������������������������� 135
Adding and Removing Ingredients������������������������������������������������������������������������������������������������������ 138
Instructions����������������������������������������������������������������������������������������������������������������������������������������� 142
Citation����������������������������������������������������������������������������������������������������������������������������������������������� 144

Custom Components���������������������������������������������������������������������������������������������������� 144


The Input List View Model������������������������������������������������������������������������������������������������������������������ 145
The Input List Template���������������������������������������������������������������������������������������������������������������������� 146
Registering the Input List Tag������������������������������������������������������������������������������������������������������������� 148

Subscribables: Cheap Messaging�������������������������������������������������������������������������������� 150


Summary���������������������������������������������������������������������������������������������������������������������� 152
Related Resources������������������������������������������������������������������������������������������������������� 153

xi

www.it-ebooks.info
■ Contents


■Chapter 8: AngularJS���������������������������������������������������������������������������������������� 155
A Declarative Approach to Building Web Applications�������������������������������������������������� 155
The Imperative Approach�������������������������������������������������������������������������������������������������������������������� 155
The Declarative Approach������������������������������������������������������������������������������������������������������������������� 157

Modules: A Foundation for Building Loosely Coupled Applications������������������������������ 158


Specifying a Bootstrap Module����������������������������������������������������������������������������������������������������������� 159

Directives: An Abstraction Layer for the DOM��������������������������������������������������������������� 160


Taking Control�������������������������������������������������������������������������������������������������������������� 163
Scopes and Prototypal Inheritance����������������������������������������������������������������������������������������������������� 163
Manipulating Scope with Controllers������������������������������������������������������������������������������������������������� 165

Loose Coupling Through Services and Dependency Injection�������������������������������������� 168


Dependency Injection������������������������������������������������������������������������������������������������������������������������� 168
Thin Controllers and Fat Services������������������������������������������������������������������������������������������������������� 169

Creating Routes������������������������������������������������������������������������������������������������������������ 173


Route Parameters������������������������������������������������������������������������������������������������������������������������������� 175
Route Resolutions������������������������������������������������������������������������������������������������������������������������������� 176

Creating Complex Forms���������������������������������������������������������������������������������������������� 178


Validation�������������������������������������������������������������������������������������������������������������������������������������������� 178
Conditional Logic�������������������������������������������������������������������������������������������������������������������������������� 183
Repeatable Sections��������������������������������������������������������������������������������������������������������������������������� 185
Summary���������������������������������������������������������������������������������������������������������������������� 188
Related Resources������������������������������������������������������������������������������������������������������� 189

■Chapter 9: Kraken���������������������������������������������������������������������������������������������� 191
Environment-Aware Configuration������������������������������������������������������������������������������� 192
Shortstop Handlers����������������������������������������������������������������������������������������������������������������������������� 196

Configuration-Based Middleware Registration������������������������������������������������������������ 200


Event Notifications������������������������������������������������������������������������������������������������������������������������������ 203

xii

www.it-ebooks.info
■ Contents

Structured Route Registration�������������������������������������������������������������������������������������� 203


Index Configuration���������������������������������������������������������������������������������������������������������������������������� 204
Directory Configuration����������������������������������������������������������������������������������������������������������������������� 205
Routes Configuration�������������������������������������������������������������������������������������������������������������������������� 207

Dust Templates������������������������������������������������������������������������������������������������������������� 208


Context and References��������������������������������������������������������������������������������������������������������������������� 209
Sections���������������������������������������������������������������������������������������������������������������������������������������������� 212
Iteration���������������������������������������������������������������������������������������������������������������������������������������������� 212
Conditionality�������������������������������������������������������������������������������������������������������������������������������������� 213
Partials����������������������������������������������������������������������������������������������������������������������������������������������� 214
Blocks������������������������������������������������������������������������������������������������������������������������������������������������� 215
Filters�������������������������������������������������������������������������������������������������������������������������������������������������� 216
Context Helpers���������������������������������������������������������������������������������������������������������������������������������� 218
Dust Helpers��������������������������������������������������������������������������������������������������������������������������������������� 225
Let’s Get Kraken��������������������������������������������������������������������������������������������������������������������������������� 230

Summary���������������������������������������������������������������������������������������������������������������������� 250
Related Resources������������������������������������������������������������������������������������������������������� 250

■Chapter 10: Mach���������������������������������������������������������������������������������������������� 251
Chapter Examples�������������������������������������������������������������������������������������������������������� 251
Installation�������������������������������������������������������������������������������������������������������������������� 252
Mach, the Web Server�������������������������������������������������������������������������������������������������� 252
HTTP Routes��������������������������������������������������������������������������������������������������������������������������������������� 254
Making Connections��������������������������������������������������������������������������������������������������������������������������� 260
Common Middleware�������������������������������������������������������������������������������������������������������������������������� 262
These Are Not the Routes You’re Looking for������������������������������������������������������������������������������������� 280
The Hosts with the Most��������������������������������������������������������������������������������������������������������������������� 282
Custom Middleware���������������������������������������������������������������������������������������������������������������������������� 287

Mach, the HTTP Client�������������������������������������������������������������������������������������������������� 289


Mach, the HTTP Proxy�������������������������������������������������������������������������������������������������� 291
Summary���������������������������������������������������������������������������������������������������������������������� 295

xiii

www.it-ebooks.info
■ Contents


■Chapter 11: Mongoose��������������������������������������������������������������������������������������� 297
Basic MongoDB Concepts�������������������������������������������������������������������������������������������� 297
A Simple Mongoose Example��������������������������������������������������������������������������������������� 300
Creating a Mongoose Schema for JSON Data������������������������������������������������������������������������������������ 301
Importing Data with Mongoose���������������������������������������������������������������������������������������������������������� 302
Querying Data with Mongoose����������������������������������������������������������������������������������������������������������� 305

Working with Schemas������������������������������������������������������������������������������������������������ 307


Data Types������������������������������������������������������������������������������������������������������������������������������������������ 307
Nested Schemas��������������������������������������������������������������������������������������������������������������������������������� 308
Default Property Values���������������������������������������������������������������������������������������������������������������������� 309
Required Properties���������������������������������������������������������������������������������������������������������������������������� 310
Secondary Indexes����������������������������������������������������������������������������������������������������������������������������� 310
Schema Validation������������������������������������������������������������������������������������������������������������������������������ 311
Schema References���������������������������������������������������������������������������������������������������������������������������� 314
Schema Middleware��������������������������������������������������������������������������������������������������������������������������� 318

Working with Models and Documents�������������������������������������������������������������������������� 321


Document Instance Methods�������������������������������������������������������������������������������������������������������������� 323
Document Virtuals������������������������������������������������������������������������������������������������������������������������������ 325
Static Model Methods������������������������������������������������������������������������������������������������������������������������� 327

Working with Queries��������������������������������������������������������������������������������������������������� 329


Model.find( )���������������������������������������������������������������������������������������������������������������������������������������� 329
Finding Documents with Query Operators������������������������������������������������������������������������������������������ 336
Summary���������������������������������������������������������������������������������������������������������������������� 343

■Chapter 12: Knex and Bookshelf����������������������������������������������������������������������� 345
Knex����������������������������������������������������������������������������������������������������������������������������� 346
Installing the Command-Line Utility��������������������������������������������������������������������������������������������������� 346
Adding Knex to Your Project��������������������������������������������������������������������������������������������������������������� 346
Configuring Knex�������������������������������������������������������������������������������������������������������������������������������� 347
The SQL Query Builder������������������������������������������������������������������������������������������������������������������������ 347
Migration Scripts�������������������������������������������������������������������������������������������������������������������������������� 355
Seed Scripts��������������������������������������������������������������������������������������������������������������������������������������� 360
xiv

www.it-ebooks.info
■ Contents

Bookshelf��������������������������������������������������������������������������������������������������������������������� 361
What Is an Object-Relational Mapper?����������������������������������������������������������������������������������������������� 361
Creating Your First Bookshelf Model��������������������������������������������������������������������������������������������������� 362
Relationships�������������������������������������������������������������������������������������������������������������������������������������� 370

Summary���������������������������������������������������������������������������������������������������������������������� 379
Related Resources������������������������������������������������������������������������������������������������������� 379

■Chapter 13: Faye������������������������������������������������������������������������������������������������ 381
HTTP, Bayeux, and WebSockets������������������������������������������������������������������������������������ 381
WebSockets���������������������������������������������������������������������������������������������������������������������������������������� 383
The Bayeux Protocol��������������������������������������������������������������������������������������������������������������������������� 384

Getting Started with Faye��������������������������������������������������������������������������������������������� 385


PubSub Messaging������������������������������������������������������������������������������������������������������� 387
Wildcard Channels������������������������������������������������������������������������������������������������������������������������������ 388

Summary���������������������������������������������������������������������������������������������������������������������� 393
Related Resources������������������������������������������������������������������������������������������������������� 394

■Chapter 14: Q����������������������������������������������������������������������������������������������������� 395
Timing Is Everything����������������������������������������������������������������������������������������������������� 395
Promises vs. Callbacks������������������������������������������������������������������������������������������������ 399
The Promise of Q���������������������������������������������������������������������������������������������������������� 401
Deferreds and Promises��������������������������������������������������������������������������������������������������������������������� 401
Values and Errors������������������������������������������������������������������������������������������������������������������������������� 406
Reporting Progress����������������������������������������������������������������������������������������������������������������������������� 412
Everything Ends���������������������������������������������������������������������������������������������������������������������������������� 415

Flow Control with Q������������������������������������������������������������������������������������������������������ 418


Sequential Flow���������������������������������������������������������������������������������������������������������������������������������� 418
Parallel Flow��������������������������������������������������������������������������������������������������������������������������������������� 420
Pipeline Flow�������������������������������������������������������������������������������������������������������������������������������������� 421

Summary���������������������������������������������������������������������������������������������������������������������� 423
Related Resources������������������������������������������������������������������������������������������������������� 423

xv

www.it-ebooks.info
■ Contents


■Chapter 15: Async.js����������������������������������������������������������������������������������������� 425
Sequential Flow������������������������������������������������������������������������������������������������������������ 426
Parallel Flow����������������������������������������������������������������������������������������������������������������� 428
Pipeline Flow���������������������������������������������������������������������������������������������������������������� 430
Reusing a Pipeline������������������������������������������������������������������������������������������������������������������������������ 433

Loop Flow��������������������������������������������������������������������������������������������������������������������� 435


Looping While Some Condition Remains True������������������������������������������������������������������������������������ 435
Looping Until Some Condition Becomes False����������������������������������������������������������������������������������� 437
Retry Loops����������������������������������������������������������������������������������������������������������������������������������������� 439
Infinite Loops�������������������������������������������������������������������������������������������������������������������������������������� 441

Batch Flow������������������������������������������������������������������������������������������������������������������� 442


Asynchronous Queue�������������������������������������������������������������������������������������������������������������������������� 442

Summary���������������������������������������������������������������������������������������������������������������������� 446

■Chapter 16: Underscore and Lodash����������������������������������������������������������������� 447
Installation and Usage�������������������������������������������������������������������������������������������������� 449
Aggregation and Indexing�������������������������������������������������������������������������������������������� 449
countBy( )�������������������������������������������������������������������������������������������������������������������������������������������� 449
groupBy( )�������������������������������������������������������������������������������������������������������������������������������������������� 451
indexBy( )�������������������������������������������������������������������������������������������������������������������������������������������� 452

Being Choosy���������������������������������������������������������������������������������������������������������������� 453


Selecting Data from Collections��������������������������������������������������������������������������������������������������������� 453
Selecting Data from Objects��������������������������������������������������������������������������������������������������������������� 456

Chaining����������������������������������������������������������������������������������������������������������������������� 460
Function Timing������������������������������������������������������������������������������������������������������������ 463
defer( )������������������������������������������������������������������������������������������������������������������������������������������������ 463
debounce( )����������������������������������������������������������������������������������������������������������������������������������������� 465
throttle( )��������������������������������������������������������������������������������������������������������������������������������������������� 466

xvi

www.it-ebooks.info
■ Contents

Templates��������������������������������������������������������������������������������������������������������������������� 468
Loops and Other Arbitrary JavaScript in Templates���������������������������������������������������������������������������� 470
Living Without Gator Tags������������������������������������������������������������������������������������������������������������������� 472
Accessing the Data Object Within a Template������������������������������������������������������������������������������������ 473
Default Template Data������������������������������������������������������������������������������������������������������������������������ 474

Summary���������������������������������������������������������������������������������������������������������������������� 475
Related Resources������������������������������������������������������������������������������������������������������� 476

Index��������������������������������������������������������������������������������������������������������������������� 477

xvii

www.it-ebooks.info
About the Authors

Tim Ambler is a software engineer from Nashville, Tennessee. His passion


for programming follows in the footsteps of his father, who introduced him
to computers at a young age with a Commodore 64. Tim is the author of
several popular open source projects, one of which (whenLive) has been
featured by GitHub’s staff. An occasional conference speaker and frequent
writer, Tim has been referenced multiple times in online publications such
as JavaScript Weekly and Node Weekly. He currently lives in the 12 South
area with his wife, Laura, and two cats. You can follow him on Twitter at
@tkambler.

Nicholas Cloud is a software developer who lives in the very humid city of
St. Louis. For over a decade he has forged his skills into a successful career.
He has developed web applications, web services, and desktop software on
diverse platforms with JavaScript, C#, and PHP. A strong proponent of open
source software, Nicholas contributes to userland projects and has written
several of his own open source libraries libraries. He speaks at a variety of
user groups and conferences and writes books, technical articles, and blog
posts in his spare time. He opines on Twitter at @nicholascloud.

xix

www.it-ebooks.info
About the Technical Reviewer

Robin Hawkes lives to learn and thrives on combining design and


code to solve problems. He’s the author of Foundation HTML5 Canvas
(Apress, 2011), which is all about making games with JavaScript. He’s
also the one-man band behind ViziCities, a WebGL-powered 3D city
visualization platform. In a previous life Robin worked in worldwide
developer relations at both Mozilla and Pusher.

xxi

www.it-ebooks.info
Acknowledgments

This book would not have been possible without the encouragement and support of a number of people:
Nicholas Cloud, my friend and co-author, without whom this book would be much more limited
in scope and depth. His knowledge, experience, and steadfast dedication to this project have been
immeasurably helpful. Thank you.
Louise Corrigan, Kevin Walter, Christine Ricketts, Melissa Maldonado, and the rest of the staff at Apress
who supported us throughout the course of this project. I am grateful for the invitation that was extended to
embark upon this journey and for the ongoing support that you have provided.
Robin Hawkes, our technical reviewer. The examples and source code included with this book have
greatly benefited from his keen insight and sharp eye.
James Coglan, the creator of Faye. Thank you for taking the time to share your technical expertise
and feedback.
My friends and colleagues Greg Jones, Jeff Crump, Seth Steele, Jon Zumbrun, and Brian Hiatt. I am
grateful for your feedback and encouragement.
—Tim
Acknowledgements are slippery things. I have so many debts, and so little space to repay.
First, the debt to my co-author Tim who reached out and invited me on this journey. We’ve never met
in person but worked remotely as co-workers for about half a year—enough time for each of us to leave an
impression on each other across the miles. For his trust, encouragement, and constant effort I am grateful.
Second, my debt to the staff at Apress who guided us through the publishing process: Kevin, Louise,
Christine, and Melissa. Their patience and careful guidance spared you, the reader, from no small amount of
cringes, and kept me on my toes during the entire writing process. They are all sharp professionals with whom
I hope to work again some day.
Third, I am indebted to Robin for his excellent technical reviews; for reading and executing more code
samples than a developer should ever be tasked with groking.
Finally, I cannot repay the subject-matter expertise I gleaned from Michael Jackson (@mjackson) while
researching Mach, and Ryan Niemeyer (@RPNiemeyer) while researching Knockout—I can only pay it forward
to you, the reader.
—Nicholas

xxiii

www.it-ebooks.info
Introduction

They tell me we’re living in an information age, but none of it seems to be the information
I need or brings me closer to what I want to know. In fact (I’m becoming more and more
convinced) all this electronic wizardry only adds to our confusion, delivering inside scoops
and verdicts about events that have hardly begun: a torrent of chatter moving at the speed
of light, making it nearly impossible for any of the important things to be heard.
—Matthew Flaming, The Kingdom of Ohio

The notion that “technology moves quickly” is a well-worn aphorism, and with good reason: technology
does move quickly. But at this moment, JavaScript in particular is moving very quickly indeed—much like
that “torrent of chatter moving at the speed of light” that Matthew Flaming refers to in The Kingdom of Ohio.
The language is in the midst of what many have called a renaissance, brought about by the rapidly increasing
sophistication of browser-based applications and the rising popularity of JavaScript on the server, thanks to
Node.js.
An almost feverish pace of innovation is occurring within the JavaScript community that, while
endlessly fascinating to follow, also presents some unique challenges of its own. JavaScript’s ecosystem of
libraries, frameworks, and utilities has grown dramatically. Where once a small number of solutions for any
given problem existed, many can now be found… and the options continue to grow by the day. As a result,
developers find themselves faced with the increasingly difficult task of choosing the appropriate tools from
among many seemingly good options.
If you’ve ever found yourself wondering why JavaScript seems to be attracting so much attention lately,
as we have, it’s worth stopping for a moment to consider the fact that JavaScript, a language that was created
by one person in ten days, now serves as the foundation upon which much of the Web as we know it sits.
A language that was originally created to solve relatively simple problems is now being applied in new
and innovative ways that were not originally foreseen. What’s more, JavaScript is a beautifully expressive
language, but it’s not without its share of rough edges and potential pitfalls. While flexible, efficient, and
ubiquitous, JavaScript concepts such as the event loop and prototypal inheritance can prove particularly
challenging for those coming to the language for the first time.
For these and many other reasons, the development community at large is still coming to terms with
how best to apply the unique features that JavaScript brings to the table. We’ve no doubt only scratched
the surface of what the language and the community behind it are capable of. For those with an insatiable
appetite for knowledge and a desire to create, now is the perfect time to be a JavaScript developer.
We have written Pro JavaScript Frameworks for Modern Web Dev to serve as your guide to a wide
range of popular JavaScript tools that solve difficult problems at both ends of the development stack: in
the browser and on the server. The tutorials and downloadable code examples contained within this book
illustrate the usage of tools that manage dependencies, structure code in a modular fashion, automate
repetitive build tasks, create specialized servers, structure client side applications, facilitate horizontal
scaling, perform event logging, and interacting with disparate data stores.
The libraries and frameworks covered include Bower, Grunt, Yeoman, PM2, RequireJS, Browserify,
Knockout, AngularJS, Kraken, Mach, Mongoose, Knex, Bookshelf, Faye, Q, Async.js, Underscore, and Lodash.

xxv

www.it-ebooks.info
■ Introduction

In writing Pro JavaScript Frameworks for Modern Web Dev, our goal was to create a filter for the
“torrent of chatter” that often seems to surround JavaScript, and in so doing, to allow what we believe are
some important things to be heard. We hope the information contained within these pages proves as useful
to you as it has to us.

Who This Book Is For


This book is intended for web developers who are already confident with JavaScript, but also frustrated with
the sheer number of solutions that exist for seemingly every problem. This book helps lift the fog, providing
the reader with an in-depth guide to specific libraries and frameworks that well-known organizations are
using right now with great success. Topics pertaining to both client-side and server-side development
are covered. As a result, readers will gain the most benefit from this book if they already have at least an
intermediate familiarity with both the web browser Document Object Model (DOM), common client-side
libraries like jQuery, and Node.js.

How This Book Is Structured


This book covers a wide selection of JavaScript tools that are applicable throughout the entire development
process, from a project’s first commit to its first release and beyond. To that end, the chapters have been
grouped into the following parts.

Part 1: Development Tools


Bower
Dependency management is hardly a new idea - well-known examples include Node’s npm, Python’s pip,
and PHP’s composer. A practice that has only recently begun to see widespread adoption, however, is the
application of this concept to the management of front-end web assets - the JavaScript libraries, stylesheets,
fonts, icons, and images that serve as the building blocks of modern web applications. In this chapter, we’ll
discover several ways in which Bower - a popular tool within this field - can improve your development
process by providing you with a mechanism for organizing these dependencies within your application.

Grunt
Larry Wall, the creator of Perl, describes the three virtues of a great programmer as: laziness, impatience,
and hubris. In this chapter, we’ll focus on a tool that will help you strengthen the virtue of laziness - Grunt.
This popular task runner provides developers with a framework for creating command-line utilities
that automative repetitive build tasks such as running tests, concatenating files, compiling SASS / LESS
stylesheets, checking for JavaScript errors, and more. After reading this chapter, you’ll know how to use several
popular Grunt plugins, as well as how to go about creating and sharing your own plugins with the community.

xxvi

www.it-ebooks.info
■ Introduction

Yeoman
Yeoman provides JavaScript developers with a mechanism for creating reusable templates (“generators”)
that describe the overall structure of a project (initially required dependencies, Grunt tasks, etc…) in a way
that can be easily re-used over and over. Broad community support also allows you to take advantage of a
wide variety of pre-existing templates. In this chapter, we’ll walk through the process of installing Yeoman
and using several popular pre-existing generators. Finally, we’ll take a look at how we can create and share
our own templates with the community.

PM2
In this chapter, we will close out our discussion of development tools by taking a look at PM2, a command-line
utility that simplifies many of the tasks associated with running Node applications, monitoring their status,
and efficiently scaling them to meet increasing demand.

Part 2: Module Loaders


RequireJS and Browserify
JavaScript’s lacks a native method for loading external dependencies in the browser—a frustrating oversight
for developers. Fortunately, the community has stepped in to fill this gap with two very different and
competing standards: the Asynchronous Module Definition (AMD) API and CommonJS. We’ll dive into the
details of both and take a look at widely-used implementations of each: RequireJS and Browserify. Each
have their merits, which we’ll discuss in detail, but both can have a profoundly positive impact on the way in
which you go about structuring your applications.

Part 3: Client-Side Frameworks


Knockout and AngularJS
In recent years, web developers have witnessed a sharp rise in popularity of so-called “single-page apps.”
Such applications exhibit behavior once available only on the desktop, but at the expense of increased code
complexity within the browser. In this section, we’ll dive into two widely-used front-end frameworks that
help minimize that complexity by providing proven patterns for solving frequently-encountered problems:
Knockout and AngularJS. Knockout focuses on the relationship between view and data, but otherwise leaves
the application architecture and plumbing to the developer’s discretion. AngularJS takes a more prescriptive
approach, covering the view, application routing, data transfer, and module design.

Part 4: Server-Side Frameworks


Kraken and Mach
Client-side applications aren’t very useful without a server with which to interact. In this section, we’ll take
a look at two popular frameworks that support developers in the creation of back-end applications: Kraken
and Mach.
Mach is more than just a simple web server: it is HTTP for the web. Mach can both serve and retrieve
content via an intuitive, extensible HTTP stack. The Mach interface remains the same whether servicing
web page requests in a Node.js application, fetching JSON data with a Mach AJAX request in the browser,
or rewriting and proxying requests to another web stack entirely. In many ways Mach is the Swiss army knife
of HTTP.

xxvii

www.it-ebooks.info
■ Introduction

Part 5: Managing Database Interaction


Mongoose, Knex, and Bookshelf
At the core of every application lies the most important component of any development stack - the data
that our users seek. In this section, we’ll become familiar with two libraries that help simplify some of the
complexity that’s often experienced when interacting with popular storage platforms such as MongoDB,
MySQL, PostgreSQL, and SQLite. After reading this section, you’ll be comfortable defining schemas,
associations, lifecycle “hooks”, and more.

Part 6: Communication
Faye
In this section, you’ll be introduced to Faye, a Node.js library that provides developers with a robust and
easy-to-use platform for building products that rely on real-time communication between servers and all
major browsers.Much of Faye’s popularity stems from the project’s goal of working everywhere the Web
works. Faye accomplishes this by providing seamless fallback support for a number of communication
protocols.

Part 7: Managing Control Flow


Q and Async.js
The asynchronous nature of JavaScript provides developers with a significant degree of flexibility - as
opposed to forcing developers to execute their code in a linear fashion, JavaScript allows developers to
orchestrate multiple actions simultaneously. Unfortunately, along with this flexibility comes a significant
degree of additional complexity - what many developers refer to as “callback hell” or the “pyramid of
doom.” In this section, we’ll examine two popular libraries that will aid you in taming the complexities of
asynchronous control flow: Q and Async.js.

Part 8: Further Useful Libraries


A number of wonderfully useful libraries exist that this book would be remiss not to cover, but for which
additional parts are not necessarily warranted. This part will cover such libraries.

Underscore and Lo-Dash


Underscore (and its successor, Lo-Dash) is an incredibly useful collection of functions that simplifies many
frequently used patterns that can be tedious to implement otherwise. This brief chapter will bring these
libraries to your attention, along with some of the more popular extensions that can also be included to
enhance their usefulness even further. Examples are included that that highlight some of the most frequently
used portions of these libraries.

xxviii

www.it-ebooks.info
■ Introduction

Downloading the Code


Each chapter in this book contains many examples, the source code for which may be downloaded from
http://www.apress.com/9781484206638 in zipped form.
Subdirectories within each chapter’s zip file contain source code (often executable) that corresponds
to specific example listings in each chapter. The first line in each chapter listing will be a source code
comment identifying the specific file path where the source code lives. If you were to encounter
Listing 0-1 in Chapter 10 (covering Mach), for example, the actual source code file would be located in
mach/example-000/no-such-file.js, relative to where the mach.zip file was extracted.

Listing 0-1. Not a Real Example


// example-000/no-such-file.js
console.log('this is not a real example');

Most examples are run with the Node.js runtime, which may be obtained from https://nodejs.org.
Chapters with additional prerequisites will explain the necessary procedures for downloading and
installing the examples. (For example, MongoDB is necessary to run examples in Chapter 11, which covers
Mongoose.)
Any additional steps necessary for running code examples (e.g., executing curl requests) or interacting
with a running example (e.g., opening a web browser and navigating to a specific URL) are explained
alongside each listing.

xxix

www.it-ebooks.info
Chapter 1

Bower

Great things are done by a series of small things brought together.


—Vincent Van Gogh

The concept of package management, also known as dependency management, is not new. Utilities within
this category provide developers with a mechanism for managing the various third-party libraries that a
project relies on. Widely used examples include
• npm: The package manager for Node.js
• Composer: A tool for dependency management in PHP
• pip: The PyPA recommended tool for installing Python packages
• NuGet: The package manager for the Microsoft development platform including .NET
While package management is hardly a new idea, a practice that has only recently begun to see
widespread adoption is the application of this concept to the management of front-end web assets—the
JavaScript libraries, stylesheets, fonts, icons, and images that serve as the building blocks of modern web
applications. The need for such structure has become evident as the foundations on which modern web
applications are built have grown in complexity. Web applications that once relied on a small selection of
broadly defined, “one size fits all” third-party libraries (e.g., jQuery) now find themselves using the work
of many more smaller libraries, each with a tightly defined purpose. Benefits of this approach include
smaller modules that are easier to test, as well as an enhanced degree of flexibility on the part of the
parent application, which can more easily extend third-party libraries or replace them altogether when
necessary.
This chapter is designed to get you up and running quickly with Bower, the front-end package manager
whose roots lie in open source initiatives at Twitter. Topics covered include
• Installing and configuring Bower
• Adding Bower to a project
• Finding, adding, and removing packages
• Semantic Versioning
• Managing the dependency chain
• Creating Bower packages

www.it-ebooks.info
Chapter 1 ■ Bower

Getting Started
All interaction with Bower occurs through a command-line utility that can be installed via npm. If you do not
already have Bower installed, you should install it before you continue, as shown in Listing 1-1.

Listing 1-1. Installing the bower Command-Line Utility via npm


$ npm install -g bower
$ bower --version
1.3.12

■■Note Node’s package manager (npm) allows users to install packages in one of two contexts: locally
or globally. In this example, bower is installed within the global context, which is typically reserved for
command-line utilities.

Configuring Bower
Bower is configured on a per-project basis through a single (optional) JSON file that exists in your project’s
root folder, .bowerrc. For the purposes of this introduction, we’ll only look at the most frequently changed
setting within this file (see Listing 1-2).

Listing 1-2. The .bowerrc File from This Chapter’s Sample Project
// example-bootstrap/.bowerrc

{
"directory": "./public/bower_components"
}

By default, Bower will store your project’s dependencies in the bower_components folder. You will likely
want to change this location, and the directory setting allows you to do so.

The Manifest
Bower provides developers with a single point of entry from which third-party libraries can be found, added,
upgraded, and removed. As these actions occur, Bower updates a JSON file referred to as the “manifest”
with an up-to-date list of the project’s dependencies. The Bower manifest for this chapter’s sample project is
shown in Listing 1-3. In this example, Bower is aware of a single dependency, the Bootstrap CSS framework.

Listing 1-3. Bower Manifest for This Chapter’s Sample Project


// example-bootstrap/bower.json

{
"name": "example-bootstrap",
"version": "1.0.0",
"homepage": "https://github.com/username/project",

www.it-ebooks.info
Chapter 1 ■ Bower

"authors": [
"John Doe <john.doe@gmail.com>"
],
"dependencies": {
"bootstrap": "3.2.0"
}
}

If we were to accidentally delete all of our project’s dependencies by removing the public/bower_
components folder, we could easily restore our project to its previous state by issuing a single command, as
shown next. Doing so would cause Bower to compare its manifest with our project’s current file structure,
determine what dependencies are missing, and restore them.

$ bower install

As a result of this behavior, we have the option of ignoring our project’s /public/bower_components
folder within version control. By committing only Bower’s manifest, and not the dependencies themselves,
our project’s source code can be kept in a cleaner state, containing only files that pertain directly to our
own work.

■■Note Opinions differ as to whether or not keeping your project’s dependencies out of version control is
a good idea. On the one hand, doing so results in a cleaner repository. On the other hand, this also opens the
door to potential problems should you (or the Bower registry, or GitHub, etc.) encounter connection issues.
The general consensus seems to be that if you are working on a “deployable” project (i.e., an application,
not a module), committing your dependencies is the preferred approach. Otherwise, keeping your project’s
dependencies out of version control is probably a good idea.

Creating a New Manifest


When you begin to use Bower within a project for the first time, it’s typically best to allow Bower to create a
new manifest for you, as shown next. Afterward, you can modify it further if necessary.

$ bower init

Finding, Adding, and Removing Bower Packages


Bower’s command-line utility provides a number of useful commands for locating, installing, and removing
packages. Let’s take a look at how these commands can help simplify the process of managing a project’s
external dependencies.

Finding Packages
One of the primary ways in which Bower can improve your development workflow is by providing you with a
centralized registry from which third-party libraries can be found. To search the Bower registry, simply pass
the search argument to Bower, followed by a keyword to search for, as shown in Listing 1-4. In this example,
only a short excerpt from the returned list of search results is shown.

www.it-ebooks.info
Chapter 1 ■ Bower

Listing 1-4. Searching Bower for jQuery


$ bower search jquery

Search results:

jquery git://github.com/jquery/jquery.git
jquery-ui git://github.com/components/jqueryui
jquery.cookie git://github.com/carhartl/jquery-cookie.git
jquery-placeholder git://github.com/mathiasbynens/jquery-placeholder.git

Adding Packages
Each search result includes the name under which the package was registered, along with the URL of the
GitHub repository at which it can be accessed directly. Once we have located the desired package, we can
add it to our project as shown in Listing 1-5.

Listing 1-5. Adding jQuery to Our Project


$ bower install jquery --save
bower jquery#* cached git://github.com/jquery/jquery.git#2.1.3
bower jquery#* validate 2.1.3 against git://github.com/jquery/jquery.git#*
bower jquery#>= 1.9.1 cached git://github.com/jquery/jquery.git#2.1.3
bower jquery#>= 1.9.1 validate 2.1.3 against git://github.com/jquery/jquery.git#>= 1.9.1
bower jquery#>= 1.9.1 cached git://github.com/jquery/jquery.git#2.1.3
bower jquery#>= 1.9.1 validate 2.1.3 against git://github.com/jquery/jquery.git#>= 1.9.1
bower jquery#>= 1.9.1 install jquery#2.1.3

jquery#2.1.3 public/bower_components/jquery

■■Note Bower does not host any of the files associated with the packages contained within its registry; it
defers to GitHub for that responsibility. While it is possible to host packages at any URL, the majority of public
packages are found on GitHub.

Take note of the fact that in Listing 1-5, we pass the --save option to Bower’s install command. By
default, the install command will add the requested package to a project without updating its manifest.
By passing the --save option, we instruct Bower to permanently store this package within its list of
dependencies.
Listing 1-6 shows the HTML from this chapter’s sample project. After adding jQuery to our project via
Bower, we can load it via a script tag as we would any other library.

www.it-ebooks.info
Random documents with unrelated
content Scribd suggests to you:
Biron’s Plot.
An attempt by the Baron de Biron, one of the King’s most trusted
generals, to unite the Catholic and Huguenot malcontents against Henri IV,
in conjunction with a league of Spain and Savoy against the French king.
The plot was betrayed by a subordinate, named La Fin, and Biron was
condemned and executed in 1602.

Bishop Usher’s Model.


A compromise between the Episcopalians and Presbyterians, proposed
by Bishop Usher after the Restoration. He suggested that while the bishops
were restored, a number of suffragan bishops should be appointed, each of
whom was to be president of a council of Presbyters. Charles II declared
himself in favour of this form of union, but when a bill was prepared to
carry it into effect, the whole power of the Court was utilized to secure its
rejection.

Bishops in Partibus Infidelium.


In the Roman Catholic Church, Bishops holding imaginary sees, in
countries where there is no Catholic community, were formerly so called.
Since 1882 they have been styled Titular Bishops.

Bismarck of Asia.
Li Hung Chang, the Chinese statesman, was so called.

Black Act.
An Act passed in 1722 to put a stop to the depredations of certain
persons who frequented Epping Forest in disguise and killed the deer. The
Act was repealed in 1827.

Black Agnes.
Agnes, wife of the Earl of March, who was distinguished for her gallant
defence of Dunbar against the English in 1339.
Black Assize.
The assize held at Oxford in July, 1577, when an outbreak of typhus
fever carried off three hundred persons, including many of the officials and
jurors attending the court.

Black Bands.
A body of German soldiers enlisted by Louis XII of France, and
employed in the Italian wars of the sixteenth century.

Black Bartholomew.
St. Bartholomew’s Day, 1662, is so called. On this day all beneficed
clergy had to declare their assent to the Book of Common Prayer, in
accordance with the provisions of the Act of Uniformity, and those who
refused were deprived of their livings. Over two thousand Presbyterians
were ejected from their parishes on this day.

Black Book.
The name given to the report of the committee appointed by Henry VIII
in 1535 to investigate the condition of the monasteries.

Black Box.
A box said to have contained the marriage certificate of Charles II and
Lucy Waters, the mother of the Duke of Monmouth, and to have been stolen
from her. Had the documents it purported to contain been forthcoming, they
would, of course, have established the Duke’s right to the throne in the
place of James II.

Black Brunswickers.
A regiment of horse raised by the Duke of Brunswick in 1809, to avenge
the death of his father who was killed at Auerstadt. They wore black
uniforms, and their badge was the skull and crossbones.

Black Circuit.
A circuit held in Cape Colony in 1812 to investigate the charges brought
by the London Missionary Society against the Dutch settlers of ill-treating
their native slaves. The results showed that the charges were grossly
exaggerated, but a great deal of illfeeling was engendered amongst the
Dutch by the thoroughness with which the English Government went into
the matter.

Black Clergy.
The members of the regular monastic orders in Russia. They alone take
any part in the ecclesiastical administration.

Black Death.
A pestilence which passed over Europe, and finally reached England in
1349. Its ravages were terrible, amounting, according to some chroniclers,
to a third of the population. It probably had its origin in the East, and is
thought by some to have been the disease now known as the Bubonic
Plague.

Black Eagle, Order of the.


The most coveted of the Prussian orders of knighthood. It was founded
by Frederick I in 1701, to commemorate his assumption of the royal title. It
is limited to thirty members, who must be of noble descent for four
generations.

Black Flags.
Rebel Chinese in the service of the King of Annam, who were the most
dangerous opponents of the French during the Tong-King war.

Black Friday.
May 11, 1866, on which day the failure of Overend and Gurney was
announced. There was a terrible panic in financial circles, and, among other
extraordinary measures, it was found necessary to suspend the Bank
Charter.
Black Hole of Calcutta.
The dungeon in which some 200 English prisoners were confined when
Calcutta was taken by Surabjah Dowlah, the Subahdar of Bengal, in 1756.
Only twenty-three survived the night.

Black Monday.
The name given to an Irish rising in County Dublin in 1209, which
nearly exterminated the newly-established English Colony.

Black Popes.
The chiefs of the Society of Jesus, during the Papacy of Pius IX, were
known by this name, their power in Rome being almost as great as that of
the Pope himself.

Black Prince.
The sobriquet of Edward, Prince of Wales, son of Edward III, from the
black armour which he habitually wore.

Black Rent.
An annual stipend paid by the English settlers within the Pale to the Irish
chieftains on their borders, in consideration of their restraining their
followers from raiding the English settlements. Black Rent was first paid
about 1410.

Black Sea Treaty.


A treaty signed in London in 1871 by the signatories of the Treaty of
Paris of 1856. In 1870, Russia, taking advantage of the Franco-German war,
issued a note, declaring herself no longer bound by the clause of that treaty
neutralising the Black Sea. A conference was called in London to consider
the situation, and by the resulting treaty the clause in question was
abrogated. The conference also took the opportunity to prolong the
existence of the Danubian Commission for a further period of twelve years.
Black Thursday.
Thursday, February 6, 1851, is so called in Victoria. A very dry summer
was followed by the simultaneous outbreak on that day of numerous bush
fires, which did enormous damage, and even threatened Melbourne, coming
within a few miles of the town.

Black Watch.
A body of Highlanders, enrolled in 1725 for the purpose of maintaining
order in the Highlands. They were made a regular line regiment in 1739,
and numbered the 43rd. They later became the 42nd, and are now the Royal
Highlanders (Black Watch).

Black Wednesday.
See Victorian Deadlocks.

Blackbirders.
The name given to the vessels engaged in the Kanaka labour traffic in
the Southern Seas.

Blackburn Riots.
A series of disturbances by the Lancashire weavers, in 1826, as a protest
against the introduction of machinery. A large amount of damage was done
before the rioters were dispersed by the troops.

Blanche Nef.
The White Ship, in which Prince William, son of Henry I, was returning
to England, after the close of Henry’s second French war. The vessel struck
coming out of Barfleur harbour, and only one of the crew escaped.

Blancs d’Espagne.
The name given to the ultra-royalist party in France who support the
claim of the Spanish Bourbons, represented by General de Bourbon, to the
throne of France.
Bland Act.
An Act of Congress passed in 1878, at the instance of Mr. Bland,
providing for the coinage of silver dollars of 412½ grains Troy, which
should be legal tender in payment of all debts and dues. The State was
bound to purchase not more than four or less than two million dollars worth
of silver per annum, to be so coined, and the profit in the operation was to
belong to the State.

Blanketeers.
The name given to a party of Lancashire operatives, who, in the famine
year of 1817, started to march to London, to demand assistance from
Parliament. Each man carried provisions and a blanket, hence the name.

Blanquillos.
The supporters of Oribe in Uruguay, in 1835. Their opponents, who
followed Rivera, were called Colorados.

Bloc, Le.
The name given to the general body of Republicans, of various shades of
opinion, in the French Chamber, who supported the Ministry of M. Combes
in 1902-3.

Bloemfontein Conference.
A conference of delegates from Cape Colony, Natal, and the Orange Free
State, which met in 1895 to discuss the question of a Customs Union. Natal
could not come to terms, and withdrew, but an arrangement was arrived at
by the other two parties, and a convention tariff, with five per cent. ad
valorem duties, was accepted by both Governments.

Bloemfontein Convention.
A convention signed in 1854, by which the British Government
abolished the Orange River Sovereignty, and recognized the independence
of the Orange Free State. Among the provisions of the treaty were clauses
binding the British Government to make no treaties with native chiefs likely
to be detrimental to the interests of the Republic, forbidding slavery, and
providing for extradition.

Blood and Iron, The Man of.


A nickname of Prince Bismarck, taken from a phrase in a speech
delivered by him in 1862.

Blood Bath of Stockholm.


The execution, by Christian II, the last king of United Scandinavia, of
many of the leaders of the Swedish National party, in 1520, after the capture
of Stockholm. In the same year Gustavus Vasa raised the standard of revolt,
and the war which followed led to the final expulsion of the Danes, and the
crowning of Gustavus as King of Sweden.

Blood Council.
A tribunal established in 1567 by Alva in the Netherlands, to deal with
the crime of treason. It had no charter, or official authority of any kind, but
it practically usurped the functions of the Council of State, and exercised
jurisdiction over all municipal bodies and provincial parliaments. It was
abolished in 1576. It was also known as the Council of Troubles.

Blood, Man of.


Charles I was so called by the Puritan party, because he waged war on
the Parliament.

Blood Tax.
The sixteenth section of the Crimes Act of 1882, by which it was
proposed to levy compensation for murder or maiming on the ratepayers of
the district where the crime was committed, was so called by the Irish
members.

Blood-red Wedding.
See Noces Vermeilles.

Blood-wite.
Another name for Were-gild.

Bloods, The Five.


The five chief septs or clans in Ireland in the middle ages. They were the
O’Neills of Ulster, the O’Briens of Thomond, the O’Connors of Connaught,
the O’Lachlans of Meath, and the M’Murroughs of Leinster.

Bloody Assize of Eperies.


A tribunal established by Leopold I of Austria after the defeat of the
Turks at Vienna and their expulsion from Hungary. It was intended to
remove those who had been concerned in Tököli’s rising, and many nobles
and magnates were brought before this tribunal on the charge of being in
correspondence with Tököli. Most of those accused were condemned, and
so numerous were the victims that thirty executioners were employed.

Bloody Assizes.
The Assizes held by Jeffreys on the Western Circuit, shortly after the
suppression of Monmouth’s rebellion in 1686. Hundreds of Monmouth’s
adherents were sent to the scaffold, or transported as slaves to the West
Indies.

Bloody Statute.
The Act of the Six Articles, passed in the reign of Henry VIII, was so
called.

Blue-Grass State.
A name sometimes given to the State of Kentucky, U.S.A., which
contains the famous blue grass region, celebrated for the raising of horses.

Blue Laws of Connecticut.


A series of enactments said to have existed in Connecticut, circ. 1640, by
which the death penalty was inflicted for idolatry, blasphemy, witchcraft,
theft, perjury, adultery and disobedience to parents. It is, however, generally
believed that they are apocryphal.

Bluff King Hal.


The nickname of Henry VIII.

Board of Control.
The board established by Pitt’s India Act in 1784 to supervise the
Government of India by the East India Company.

Bobbing John.
The sobriquet of the Earl of Mar, the Jacobite leader in the rebellion of
1815. He was a notorious trimmer.

Bocca di Leone.
The name given to the opening in the wall of the antechamber in the
Doge’s Palace at Venice, into which anonymous accusations were dropped.

Bocland.
In Saxon times, land held by grant or by charter from the public lands.

Body of Liberties.
The first constitution of Massachusetts, prepared by Nathaniel Ward. It
provided that all public officials should be chosen annually by the freemen
of the plantation. Each town also elected deputies to a general assembly, to
serve for one year. Each town had the right to make its own by bye-laws. It
further provided for the annual election of judges, and for equal justice to
all, including foreigners, while severe penalties were enacted for witchcraft
and blasphemy.

Bomba.
The sobriquet of Ferdinand II, King of the Two Sicilies (1759-1825).

Bombay, Cession of.


Bombay was ceded to Charles II by Portugal in 1662, as part of the
dowry of the Infanta of Portugal. In 1668 it was surrendered by the Crown
to the East India Company.

Bonaght.
See Coyne and Livery.

Bond.
See Afrikander.

Bond-Blaine Convention.
An agreement between Newfoundland and the United States, signed in
1890, providing for the continuance of the modus vivendi affording
reciprocal fishing rights to the two countries.

Bondevenner.
The Peasants’ Friends, a political party formed in Denmark in 1845, in
the interests of the rural population.

Bondi.
In Norse times, the freeholders or owners of Odal land.

Book of Rates.
A table of unauthorized import duties issued by Cecil, Earl of Salisbury,
in 1608, after the decision in the Crown’s favour in Bates’ case. In 1610 the
Commons declared these impositions illegal.

Book of Sports.
A declaration of James I in 1618, as to the sports which might lawfully
be indulged in on Sundays after Divine Service. Dancing, archery,
maypoles, leaping were permitted; bear-baiting was forbidden. None,
however, might take part unless they had been to church.

Booth’s Conspiracy.
A conspiracy headed by John Wilkes Booth, at the end of the American
Civil War, having for its object the assassination of the President, Vice-
President, and some others. President Lincoln was shot by Booth on April
14, 1865, and on the same date Seward, the Secretary of State, was
wounded by Payne, another of the conspirators. The conspirators were
brought to trial, and four of them hanged, the others being sentenced to
various terms of imprisonment.

Border Laws.
A code of laws framed in 1249 by a commission composed of twelve
English and twelve Scottish knights. They dealt with the surrender of
fugitives crossing the border, and provided for the trial of border raiders by
special courts, held under the joint authority of the two nations.

Border States.
Before the American Civil War, this name was applied to the States
bordering on the free states, namely, Delaware, Maryland, Virginia,
Kentucky, and Missouri.

Borough English, Custom of.


An old system of land tenure, still existing in certain ancient boroughs,
whereby real estate passes to the youngest son.

Boston Massacre.
A small affray in Boston in 1770, in which the troops fired on the rioters,
and a few persons were killed. Captain Preston, who commanded the
troops, was tried and acquitted.
Boston Port Act.
An Act passed in 1774, closing the Custom House and Port of Boston. It
was passed as a measure of retaliation for the action of the inhabitants in
preventing the importation of tea by the East India Company free of the
English duty.

Boston Tea Riots.


In December, 1773, on the arrival of the tea-ships of the East India
Company, bringing duty-free tea, the ships were boarded by a party of men
disguised as Red Indians, who threw the tea into the harbour. The result of
this action was the passing of the Boston Port Act.

Botany Bay.
A small inlet in the coast of New South Wales, where the first convict
establishment was formed in 1787. The penal settlement was removed to
Port Jackson in the following year, but the name was constantly used,
generically, for the convict settlements in Australia.

Boulangists.
The supporters of General Boulanger, who obtained a brief popularity in
France in 1886, largely owing to the army reforms he introduced while
Minister of War. He gradually, however, attracted to his standard the
reactionary parties, who hoped that he would destroy Parliamentary
Government. He quickly obtained a large following in the country, rather by
denunciation of Parliamentary abuses than by the advocacy of any definite
policy, and in 1888 he was elected for three Departments. At this period he
might have overturned the Government, but shrank from the decisive step,
and from that time his influence began to wane. He left France to escape
prosecution, and his following quickly dwindled away, until in 1890, it was
found desirable to dissolve the Boulangist committee. Boulanger committed
suicide in Brussels in 1891.

Bounty, Mutiny of the.


A mutiny on board H.M.S. Bounty, Captain Bligh, headed by a master’s
mate named Christian, in 1790. The mutineers made first for Tahiti, but
eventually settled on Pitcairn Island, where they founded a community
whose descendants still inhabit the island. Pitcairn Island was taken under
British protection in 1839.

Boustrapa.
A nickname of Napoleon III, compounded of the first syllables of
Boulogne, Strasbourg, and Paris, the scenes of his two unsuccessful and one
successful coups d’état, in 1840, 1836, and 1851 respectively.

Bow Street Runners.


Eight famous police officers, attached to Bow Street Police Court, who
were appointed about 1805. The most famous of them was Townsend. They
were also known as the “Robin Redbreasts” from their red waistcoats.

Boxers.
A Chinese Secret Society, whose principal object is the expulsion from
China of Europeans, and especially of missionaries. They have met with
considerable sympathy in Court circles, and their outrages in 1900 led to a
joint European expedition. Their rising was suppressed for a time, but the
agitation is seething, and may break out again at any time.

Boy Popes.
This title is given to John XII, who was elected Pope in 956, at the age
of eighteen, and Benedict IX, who was Pope from 1033 to 1044, having
been chosen at the age of ten.

Boyars.
In early Russian history, the large landowners, under the authority of the
great princes who ruled the various Principalities into which Russia was
divided.
Boycotting.
One of the weapons employed by the Irish Land League, in its campaign
against the landlords. It consists in ostracizing the person aimed at, and
forbidding any one to deal with or work for him, or supply his wants. Its
first victim was Captain Boycott, the agent of the Earl of Erne in 1880, and
from his name the word is derived.

Boys.
The name given by Walpole to the party of young Whigs, under William
Pitt, who acted with the “Patriots” in 1733.

Braemar Gathering.
See Hunting of Braemar.

Brahmins.
The highest or priestly caste among the Hindus.

Brahmo Somaj.
A Hindu sect, founded in 1830 by Rammohun Roy. Its tenets are
monotheistic, rejecting the numerous gods of the Hindu Pantheon, and
adoring Brahma as the supreme deity. Its adherents ignore all caste
distinctions.

Brandy Nan.
Queen Anne was so called by the Londoners.

Bras de Fer.
The sobriquet of Baldwin, first Count of Flanders.

Bras Droit du Cardinal.


A nickname of François du Tremblay, the familiar of Cardinal Richelieu.
He was also called the Alter Ego of Richelieu, and l’Eminence Grise.
Brass Band, The Pope’s.
A band of agitators in Ireland, under the leadership of John Sadleir, who
stumped the country in opposition to the Ecclesiastical Titles Bill in 1851.

Brave des Braves, Le Plus.


The sobriquet of Marshal Ney, conferred on him by Napoleon during the
Russian campaign of 1812.

Bread and Cheese War.


A peasant revolt in Kemmerland and Friesland in 1491, caused by the
exaction of the Ruytergeld, notwithstanding the enormous price of bread.

Bread Riots.
A series of disturbances in various parts of England, in 1816, caused by
the high prices of food-stuffs, due to the bad harvest and the cessation of the
Great War. In many places it was necessary to call out the military to
disperse the rioters.

Breda, Compromise of.


The agreement between the Catholic and Protestant nobles of the
Netherlands to agitate for the exclusion of the Inquisition. It was signed at
Breda in 1566, and from it originated the Society of the Gueux.

Breda, Declaration of.


A manifesto issued by Charles II, in 1660, after the retirement of Richard
Cromwell. By this instrument he promised a general amnesty, liberty of
conscience, the settlement by Parliament of the various claims to forfeited
estates, and payment of all arrears due to the army, subject always to such
advice as might subsequently be tendered him by Parliament.

Breda, Peace of.


Three treaties signed by England with Holland, France and Denmark
respectively in 1667, after the naval war with Holland, in which de Witte
had succeeded in penetrating to Sheerness. By the treaty with Holland, each
country retained her conquests, England thus securing New York and New
Jersey, and Holland, Surinam. By the treaty with France, England acquired
St. Kitts, Antigua and Montserrat, and restored to France Nova Scotia and
Cayenne. By that with Denmark, the latter power reserved her right to the
Orkneys.

Brehon Law.
The Irish Law which prevailed throughout Ireland after the conquest by
Henry II, excepting within the Pale. It was abolished in the reign of James I.

Breslau, Treaty of.


A treaty between Prussia and Austria, signed in 1742, after Frederick’s
victory at Chotusitz. Austria ceded Silesia to Prussia.

Brétigny, Peace of.


A treaty, signed in 1360, four years after the battle of Poitiers, between
Edward III and the Dauphin Charles. By it France surrendered to England,
Gascony, Guienne, and Poitou, Saintonge, Périgord, Limoges and other
counties in the south, Montreuil, Ponthieu and Calais in the north, freed
from all feudal claims. England surrendered her claim to the French crown,
and to all sovereignty in Normandy, Touraine, Anjou, Maine, Brittany and
Flanders, and agreed to release King John on payment of a ransom of three
million gold pieces.

Breton Club.
A revolutionary club formed in Paris in the early days of the Revolution.
Its founders were certain Breton deputies, and among its members were
many who were afterwards prominent Jacobins, amongst others
Robespierre.

Bretts and Scots, Laws of the.


The code of laws under which the Celtic inhabitants of Scotland were
governed, up to the thirteenth century. This code was abolished by an edict
of Edward I, when he conquered Scotland in 1305.

Bretwalda.
Under the Saxon Heptarchy, the sovereign of one of the seven kingdoms
was often acknowledged as the leader of the Federation, under the title of
Bretwalda.

Brewer of Ghent.
James van Arteveldt, the leader of the Burgher party in Flanders in 1338,
was so called.

Bridal of Norwich.
A conspiracy against William I, entered into at the bridal feast of Ralph
of Gwader, Earl of Norfolk, and Emma, sister of the Earl of Hereford. The
two earls, with Waltheof, Earl of Nottingham, designed to depose William
and divide the kingdom between them. Waltheof seems to have repented,
and confessed the plot to Lanfranc. The conspiracy was at once suppressed,
Waltheof executed, and Hereford imprisoned for life, while Ralph escaped
to Brittany.

Bride of the Sea.


Venice was so called, in allusion to the annual ceremony of the Marriage
of the Adriatic.

Brig-bot.
In Anglo-Saxon times, a tax levied on freemen for the repair of bridges.

Brigham, Treaty of.


A treaty between England and Scotland signed in 1290, by which a
marriage was arranged between the Maid of Norway, heiress to the Scottish
throne, and the son of Edward I. It was agreed that the two kingdoms,
though under one crown, should remain separate, each under its own laws.
England was not to call on Scotland for military aid, and no appeal was to
lie from the Scotch to the English courts. The death of the Maid of Norway,
however, rendered the stipulations of this treaty null and void.

Bright Clauses.
The clauses in the Irish Land Act of 1870, dealing with the sale of land
to tenants are so called, John Bright having for many years advocated State
aid in the creation of a peasant proprietary in Ireland.

Brilliant Madman.
Charles XII of Sweden is so called.

Brissotins.
The followers of Brissot, one of the leaders of the Gironde, during the
French Revolution. The name fell into disuse, as the party became merged
in the Girondins.

Bristol Riots.
A riot in Bristol in 1831, consequent upon the rejection of the Reform
Bill by the House of Lords. The Recorder of Bristol, Sir Charles Wetherell,
was mobbed on his entrance into the city, and the rioters seized the town
hall. The weakness of the authorities left the disorder unchecked for two
days, but at the last the military were called out and the disturbance
suppressed.

British Empire League.


An association formed in 1896 to carry on the work of the Imperial
Federation League, in educating the nation to an understanding of the needs
of the Empire. The Duke of Devonshire was the first president.

Broad-bottomed Administration.
Pelham’s Ministry as reconstructed in 1744 was so called, because it
contained members representing every shade of Whig opinion, and even a
certain admixture of Toryism.
Brömsebro, Treaty of.
A treaty between Sweden and Denmark, signed in 1645, by which
Denmark surrendered Jämtland, Hejealand and Halland, and granted to
Swedish vessels exemption from the payment of Sound Dues.

Brother Jonathan.
The nickname of the American nation.

Brothers, Battle of the.


The name given to the battle of Fontenay, June 25, 841, at which Charles
the Bald and Louis the German, sons of Louis le Debonaire, totally defeated
their brother Lothair.

Brownists.
A dissenting sect, who seceded from the Church in 1582. They objected
to general church government, and claimed for each congregation the right
to regulate its own worship. They may be considered the forerunners of the
Independents.

Brunnen, League of.


See Perpetual League.

Brussels Conference, 1874.


A conference of the Powers held in Brussels in 1874, at the suggestion of
the Russian Government, to consider the usages of war. Great Britain
entered the conference with many reservations, declining to send a
plenipotentiary, and no changes of any importance were agreed to.

Brussels Conference, 1876.


A conference of the Powers held at Brussels in 1876, at which an
International Association was formed for the purpose of exploring and
civilizing Central Africa. This association was the germ of the Congo Free
State.
Brussels Convention.
A convention signed by the sugar-producing countries in 1902, by which
the contracting parties undertook that in the event of any sugar-producing
country declining to abolish bounties, they would prohibit the importation
of sugar from such country, or impose countervailing duties.

Brussels, Union of.


An agreement, signed in 1517 by certain Catholic noblemen of the
Netherlands, to unite for the purpose of expelling the Spanish garrison,
while at the same time maintaining the Catholic religion, and the
sovereignty of the king.

Buccaneers.
An association of sea-rovers formed about 1525, to harry the Spanish
possessions in South America, and prey upon their commerce. They were of
various nationalities, but chiefly English and French, and their most famous
leaders were Montbars, known as the Exterminator, and Henry Morgan,
afterwards Sir Henry, and Deputy-Governor of Jamaica. Under the latter
leader they crossed the Isthmus and sacked the city of Panama in 1671, and
for years they paralyzed the Spanish trade, both in the Caribbean Sea and in
the Pacific. They ceased to exist as an association early in the eighteenth
century, but some of them continued a career of indiscriminate piracy for
many years longer. They were called by the French Flibustiers.

Bucharest, Treaty of.


A treaty, signed by Russia and Turkey in 1812, after the war which
began in 1806, and ended in the defeat of the Turks by Kutusoff in the later
year. Turkey by this treaty surrendered all her territory north of the Pruth.

Buckeye State.
The popular name of the State of Ohio, U.S.A., from the number of
buckeye-trees found within its borders.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

textbookfull.com

You might also like