JavaScript Frameworks for Modern Web Dev

Book description

JavaScript Frameworks for Modern Web Dev is your guide to the wild, vast, and untamed frontier that is JavaScript development.

The JavaScript tooling landscape has grown and matured drastically in the past several years. This book will serve as an introduction to both new and well established libraries, frameworks, and utilities that have gained popular traction and support from seasoned developers. It covers tools applicable to the entire development stack, both client- and server-side.

While no single book can possibly cover every JavaScript library of value, JavaScript Frameworks for Modern Web Dev focuses on incredibly useful libraries and frameworks that production software uses. You will be treated to detailed analyses and sample code for tools that manage dependencies, structure code in a modular fashion, automate repetitive build tasks, create specialized servers, structure client side applications, facilitate horizontal scaling, 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.

Written from first-hand experience, you will benefit from the glorious victories and innumerable failures of two experienced professionals, gain quick insight into hurdles that aren't always explicitly mentioned in API documentation or Readmes, and quickly learn how to use JavaScript frameworks and libraries like a Pro.

Enrich your development skills with JavaScript Frameworks for Modern Web Dev today.

Table of contents

  1. Cover
  2. Title
  3. Copyright
  4. Dedication
  5. Contents at a Glance
  6. Contents
  7. About the Authors
  8. About the Technical Reviewer
  9. Acknowledgments
  10. Introduction
  11. Chapter 1: Bower
    1. Getting Started
    2. Configuring Bower
    3. The Manifest
      1. Creating a New Manifest
    4. Finding, Adding, and Removing Bower Packages
      1. Finding Packages
      2. Adding Packages
      3. Removing Packages
    5. Semantic Versioning
    6. Managing the Dependency Chain
    7. Creating Bower Packages
      1. Choose a Valid Name
      2. Use Semver Git Tags
      3. Publish Your Package to the Registry
    8. Summary
  12. Chapter 2: Grunt
    1. Installing Grunt
    2. How Grunt Works
      1. Gruntfile.js
      2. Tasks
      3. Plugins
      4. Configuration
    3. Adding Grunt to Your Project
      1. Maintaining a Sane Grunt Structure
    4. Working with Tasks
      1. Managing Configuration
      2. Task Descriptions
      3. Asynchronous Tasks
      4. Task Dependencies
      5. Multi-Tasks
      6. Multi-Task Options
      7. Configuration Templates
      8. Command-Line Options
      9. Providing Feedback
      10. Handling Errors
    5. Interacting with the File System
      1. Source-Destination Mappings
      2. Watching for File Changes
    6. Creating Plugins
      1. Getting Started
      2. Creating the Task
      3. Publishing to npm
    7. Summary
    8. Related Resources
  13. Chapter 3: Yeoman
    1. Installing Yeoman
    2. Creating Your First Project
      1. Subcommands
    3. Creating Your First Generator
      1. Yeoman Generators are Node Modules
      2. Sub-Generators
      3. Defining Secondary Commands
      4. Composability
    4. Summary
      1. Related Resources
  14. Chapter 4: PM2
    1. Installation
    2. Working with Processes
      1. Recovering from Errors
      2. Responding to File Changes
    3. Monitoring Logs
    4. Monitoring Resource Usage
      1. Monitoring Local Resources
      2. Monitoring Remote Resources
    5. Advanced Process Management
      1. JSON Application Declarations
    6. Load-Balancing Across Multiple Processors
      1. Zero-Downtime Deployments
    7. Summary
    8. Related Resources
  15. Chapter 5: RequireJS
    1. Running the Examples
    2. Working with RequireJS
      1. Installation
      2. Configuration
      3. Application Modules and Dependencies
      4. Paths and Aliases
      5. Shims
      6. Loader Plugins
      7. Cache Busting
    3. RequireJS Optimizer
      1. Configuring r.js
      2. Running the r.js Command
    4. Summary
  16. Chapter 6: Browserify
    1. The AMD API vs. CommonJS
    2. Installing Browserify
    3. Creating Your First Bundle
    4. Visualizing the Dependency Tree
    5. Creating New Bundles As Changes Occur
      1. Watching for File Changes with Grunt
      2. Watching for File Changes with Watchify
    6. Using Multiple Bundles
    7. The Node Way
      1. Module Resolution and the NODE_PATH Environment Variable
      2. Dependency Management
    8. Defining Browser-Specific Modules
    9. Extending Browserify with Transforms
      1. brfs
      2. folderify
      3. bulkify
      4. Browserify-Shim
    10. Summary
    11. Related Resources
  17. Chapter 7: Knockout
    1. Views, Models, and View Models
      1. The Recipe List
      2. Recipe Details
    2. Binding View Models to the DOM
    3. View Models and Forms
      1. Switching to “Edit” Mode
      2. Changing the Recipe Title
      3. Updating Recipe Servings and Cooking Time
      4. Adding and Removing Ingredients
      5. Instructions
      6. Citation
    4. Custom Components
      1. The Input List View Model
      2. The Input List Template
      3. Registering the Input List Tag
    5. Subscribables: Cheap Messaging
    6. Summary
    7. Related Resources
  18. Chapter 8: AngularJS
    1. A Declarative Approach to Building Web Applications
      1. The Imperative Approach
      2. The Declarative Approach
    2. Modules: A Foundation for Building Loosely Coupled Applications
      1. Specifying a Bootstrap Module
    3. Directives: An Abstraction Layer for the DOM
    4. Taking Control
      1. Scopes and Prototypal Inheritance
      2. Manipulating Scope with Controllers
    5. Loose Coupling Through Services and Dependency Injection
      1. Dependency Injection
      2. Thin Controllers and Fat Services
    6. Creating Routes
      1. Route Parameters
      2. Route Resolutions
    7. Creating Complex Forms
      1. Validation
      2. Conditional Logic
      3. Repeatable Sections
    8. Summary
    9. Related Resources
  19. Chapter 9: Kraken
    1. Environment-Aware Configuration
      1. Shortstop Handlers
    2. Configuration-Based Middleware Registration
      1. Event Notifications
    3. Structured Route Registration
      1. Index Configuration
      2. Directory Configuration
      3. Routes Configuration
    4. Dust Templates
      1. Context and References
      2. Sections
      3. Iteration
      4. Conditionality
      5. Partials
      6. Blocks
      7. Filters
      8. Context Helpers
      9. Dust Helpers
      10. Let’s Get Kraken
    5. Summary
    6. Related Resources
  20. Chapter 10: Mach
    1. Chapter Examples
    2. Installation
    3. Mach, the Web Server
      1. HTTP Routes
      2. Making Connections
      3. Common Middleware
      4. These Are Not the Routes You’re Looking for...
      5. The Hosts with the Most
      6. Custom Middleware
    4. Mach, the HTTP Client
    5. Mach, the HTTP Proxy
    6. Summary
  21. Chapter 11: Mongoose
    1. Basic MongoDB Concepts
    2. A Simple Mongoose Example
      1. Creating a Mongoose Schema for JSON Data
      2. Importing Data with Mongoose
      3. Querying Data with Mongoose
    3. Working with Schemas
      1. Data Types
      2. Nested Schemas
      3. Default Property Values
      4. Required Properties
      5. Secondary Indexes
      6. Schema Validation
      7. Schema References
      8. Schema Middleware
    4. Working with Models and Documents
      1. Document Instance Methods
      2. Document Virtuals
      3. Static Model Methods
    5. Working with Queries
      1. Model.find()
      2. Finding Documents with Query Operators
    6. Summary
  22. Chapter 12: Knex and Bookshelf
    1. Knex
      1. Installing the Command-Line Utility
      2. Adding Knex to Your Project
      3. Configuring Knex
      4. The SQL Query Builder
      5. Migration Scripts
      6. Seed Scripts
    2. Bookshelf
      1. What Is an Object-Relational Mapper?
      2. Creating Your First Bookshelf Model
      3. Relationships
    3. Summary
    4. Related Resources
  23. Chapter 13: Faye
    1. HTTP, Bayeux, and WebSockets
      1. WebSockets
      2. The Bayeux Protocol
    2. Getting Started with Faye
    3. PubSub Messaging
      1. Wildcard Channels
    4. Summary
    5. Related Resources
  24. Chapter 14: Q
    1. Timing Is Everything
    2. Promises vs. Callbacks
    3. The Promise of Q
      1. Deferreds and Promises
      2. Values and Errors
      3. Reporting Progress
      4. Everything Ends
    4. Flow Control with Q
      1. Sequential Flow
      2. Parallel Flow
      3. Pipeline Flow
    5. Summary
    6. Related Resources
  25. Chapter 15: Async.js
    1. Sequential Flow
    2. Parallel Flow
    3. Pipeline Flow
      1. Reusing a Pipeline
    4. Loop Flow
      1. Looping While Some Condition Remains True
      2. Looping Until Some Condition Becomes False
      3. Retry Loops
      4. Infinite Loops
    5. Batch Flow
      1. Asynchronous Queue
      2. Asynchronous Cargo
    6. Summary
  26. Chapter 16: Underscore and Lodash
    1. Installation and Usage
    2. Aggregation and Indexing
      1. countBy()
      2. groupBy()
      3. indexBy()
    3. Being Choosy
      1. Selecting Data from Collections
      2. Selecting Data from Objects
    4. Chaining
    5. Function Timing
      1. defer()
      2. debounce()
      3. throttle()
    6. Templates
      1. Loops and Other Arbitrary JavaScript in Templates
      2. Living Without Gator Tags
      3. Accessing the Data Object Within a Template
      4. Default Template Data
    7. Summary
    8. Related Resources
  27. Index

Product information

  • Title: JavaScript Frameworks for Modern Web Dev
  • Author(s): Tim Ambler, Nicholas Cloud
  • Release date: October 2015
  • Publisher(s): Apress
  • ISBN: 9781484206621