Preface
Who This Book Is For
Format
Code Samples & Repositories
Errata
Feedback
Chapter 1: A Node.js Primer
Node.js Introduction
Installing Node.js
Obligatory "Hello World" in Node.js
Installing Modules with npm
Chapter 2: Introduction to Express.js
Templates & Views
Dynamic Templates & Passing Data to Views
Chapter 3: Creating an MVC Express.js Application
Application Setup
Templating
Router
Controllers
Passing Data to Views
Partial Views
Summary
Chapter 4: Middleware & Configuration
Middleware
Configuration
Summary
Chapter 5: Debugging Node.js Applications
Installing Node Inspector
Debugging With Node Inspector
Summary
Chapter 6: Data Access & Validation With MongoDB
Installing Mongoose
Database Settings in config.js
Creating Data Models
Accessing Data in Controllers and Views
Editing and Deleting Data
Deleting Data
Editing Data
Testing It All Out
Validation of Data
Summary
Chapter 7: Relational Data in MongoDB
Updating Data Models
Adding Object References
Editing Items and Handlebars Helpers
Summary
Chapter 8: AJAX in Express.js Applications
Setup
Sending AJAX Requests
Summary
Chapter 9: Sessions & Authentication in Express.js
Getting Started with Sessions and Authentication
Authenticating Users Stored in a Database
Updating Code to Check Credentials on Sign In
Installation and Creating a Default User
Authenticated AJAX Requests
Summary
Chapter 10: Security
Cross-site Request Forgery
Anti-CSRF Tokens and AJAX Requests
Cross-Site Scripting (XSS)
Session Hijacking / Cookie Stealing
Use HTTPS
Summary
Chapter 11: Putting it All Together: Creating an Application
Setting Up Our Application
Middleware
Router.js
Views
Static Files
Running the Application
Data Models
Building the Admin Panel
Installation Routes & Creating a Default User
Dynamic Page & Post Routes
404 & Error Routes
Summary
Conclusion
Appendix A: Code Samples & Repos
Appendix B: MongoDB Shell