You are previewing Write Modern Web Apps with the MEAN Stack: Mongo, Express, AngularJS, and Node.js.
O'Reilly logo
Write Modern Web Apps with the MEAN Stack: Mongo, Express, AngularJS, and Node.js

Book Description

Traditionally, web applications have been architected so that the back-end houses all the front-end code. This has resulted in heavy projects that are difficult to manage and scale. This book will explain a new way to write web applications by treating the front-end as if it were a third-party (such as a mobile client). This book, written by a practicing MEAN developer, will take a holistic approach to using the MEAN JavaScript platform for creating modern web applications and lay out how to use the MEAN (Mongo, Express, AngularJS, and Node.js) set of tools to create a web application, from installation and setup of the tools to debugging and deploying your app. After an introduction to how web development is changing and the advantages of using the MEAN stack, the author jumps into an introduction to each tool and then dives into using the complete JavaScript-based application stack to build, test, and deploy apps.

Table of Contents

  1. Title Page
  2. Copyright Page
  3. Dedication Page
  4. About the Author
  5. Contents
  6. Preface
    1. Who Is This Book For?
    2. Why I Wrote This Book
  7. Introduction
  8. Chapter 1. How Modern Web Architecture Is Changing
    1. The Rise of the Static App
    2. Enter the Thick Client
  9. Chapter 2. Why JavaScript Is a Good Choice for Modern Apps
    1. What Is Angular.js?
    2. What Is Node.js?
    3. What Is Express?
    4. What Is MongoDB?
  10. Chapter 3. Introducing the Social Networking Project
    1. Creating a Static Mockup of the Recent Posts Page
    2. Angularizing the Page
    3. Adding New Posts
    4. Next Steps
  11. Chapter 4. Building a Node.js API
    1. The Stock Endpoint
    2. Creating Posts via the API
    3. MongoDB Models with Mongoose
    4. Using Mongoose Models with the POST Endpoint
    5. Next Steps
  12. Chapter 5. Integrating Node with Angular
    1. $http
    2. Reading Posts from the API with $http
    3. Serving posts.html Through Node
    4. Saving Posts to the API with $http
    5. Fixing the Post Ordering
    6. Cleaning Up server.js
    7. Cleaning Up Angular
    8. Next Steps
  13. Chapter 6. Automating Your Build with Gulp
    1. Introducing Grunt and Gulp
    2. Gulp Hello World
    3. Building JavaScript with Gulp
    4. Building CSS with Gulp
    5. Gulp Dev Task
    6. Other Gulp Plug-ins
    7. Next Steps
  14. Chapter 7. Building Authentication in Node.js
    1. Introducing Token Authentication
    2. JSON Web Token (JWT)
    3. Using BCrypt
    4. Authentication with MongoDB
    5. Next Steps
  15. Chapter 8. Adding Routing and Client Authentication
    1. Routing
    2. Creating a Login Form
    3. Express Authentication
    4. Angular Events
    5. Authenticating Social Posts
    6. HTML5 Pushstate
    7. Registration
    8. Logout
    9. Remember Me
    10. User Foreign Key
    11. Next Steps
  16. Chapter 9. Pushing Notifications with WebSockets
    1. Introducing WebSockets
    2. How WebSockets Work
    3. What Should You Use WebSockets For?
    4. WebSockets in Your Social App
    5. WebSockets in Angular.js
    6. WebSocket Architecture
    7. Dynamic WebSocket Hostname
    8. Next Steps
  17. Chapter 10. Performing End-to-End Testing
    1. Setting Up Protractor
    2. JavaScript Testing Frameworks
    3. Writing a Basic Protractor Test
    4. Protractor Expectations
    5. chai-as-promised
    6. When to Use End-to-End Tests
    7. Next Steps
  18. Chapter 11. Testing the Node Server
    1. Not Quite Unit Testing
    2. Mocha for Node
    3. Post Controller
    4. SuperTest
    5. Base Router
    6. Using the Base Router with SuperTest
    7. Models in Controller Tests
    8. Testing Controllers with Authentication
    9. Code Coverage
    10. The npm test Command
    11. JSHint
    12. Next Steps
  19. Chapter 12. Testing Angular.js
    1. Using Karma
    2. Using Bower
    3. Setting Up Karma
    4. Basic Karma Service Test
    5. HTTP Testing with Karma
    6. Karma Controller Test
    7. Testing Spies
    8. Next Steps
  20. Chapter 13. Deploying to Heroku
    1. Platform-as-a-Service
    2. How Heroku Works
    3. Twelve-Factor Apps
    4. Deploying an Application to Heroku
    5. MongoDB on Heroku
    6. Redis on Heroku
    7. Compiling Assets
    8. Node Cluster
    9. Next Steps
  21. Chapter 14. Deploying to Digital Ocean
    1. What Is Digital Ocean?
    2. Single-Server vs. Multiserver Architecture
    3. Fedora 20
    4. Creating a Server
    5. Installing Node
    6. Installing MongoDB
    7. Installing Redis
    8. Running the Social App
    9. Running Social App Under systemd
    10. Zero-Downtime Deploys
    11. Multiserver Migration
    12. Next Steps
    13. Conclusion
  22. Index