A beginner's practical guide to the JavaScript stack.

Learn to write MEAN Stack applications from scratch

Want to learn Node.js and AngularJS?

In this book, we will be learning about four pieces of software (MongoDB, ExpressJS, AngularJS, and Node.js) and how they combine to make the great MEAN stack.

This book is suitable for beginners with no Angular or Node experience. Only a very basic knowledge of HTML and JavaScript is necessary.

What You’ll Learn

You’ll gain a great real-world understanding of how to use Node and Angular. You will also learn the following:

  • Build Node/Express applications and RESTful APIs from scratch
  • How to authenticate Node and Angular applications
  • Handle CRUD operations with MongoDB
  • Build dynamic Angular frontend applications from scratch
  • Build scalable and well-structured MEAN applications
  • Best practices and techniques in application development
  • Use Bower and Gulp for efficient development

This book is essentially three books in one. Getting Started with Angular, Getting Started with Node, and Building Applications with Node and Angular.

You'll have the knowledge to build not just MEAN apps, but standalone Node and standalone Angular applications as well.

What You'll Build

  • RESTful API in Node and Express with token based authentication
  • Angular token based authentication
  • MEAN stack CRM to manage users
  • Starter MEAN app with Bower and Gulp
  • And more...

Why MEAN?

You’ve probably heard of the MEAN stack around the web and have been wondering what’s so great about it. Building with the four MEAN components can create not only amazing applications, but also a faster and easier development process.

Having entire applications written in JavaScript makes development easier since you only have to deal with one language for the backend and frontend. This means your development time is shorter, your team can work better together, and your JavaScript knowledge can transfer across your entire development stack.

AngularJS Updates

This book will be updated for the upcoming versions of Angular: 1.4, 1.5, and 1.6. Angular will also be releasing a new router soon and this book will be updated for that as well.

Code Samples

Code samples are provided in a GitHub repository to download and use for learning or within your own projects.

Chris Sevilleja

Chris is one of the co-founders of Scotch and is pretty much in love with the MEAN stack.

Holly Lloyd

Holly is an algorithms nerd, but she took time out of that to put down her knowledge of Node and Angular into this book (Mean Machine).

  • Preface

    • Conventions Used in This Book

    • Code Samples

    • Get In Contact

  • Introduction

    • Why MEAN?

    • When To Use the MEAN Stack

    • When NOT To Use the MEAN Stack

    • Who’s Getting MEAN?

  • Primers

    • MongoDB

    • Node.js

    • ExpressJS

    • AngularJS

  • MEAN Thinking

    • Client-Server Model

    • Book Outline

  • Getting Started and Installation

    • Requirements

    • Tools

    • Installation

  • Starting Node

    • Configuration (package.json)

    • Initialize Node App

    • Creating a Very Simple Node App

    • Starting a Node Application

    • Packages

    • Recap

  • Starting a Node Server

    • Sample Application

    • Method #1: Pure Node (no Express)

    • Method #2: Using Express

  • Routing Node Applications

    • Express Router

    • Sample Application Features

    • Basic Routes

    • express.Router()

    • Route Middleware (router.use())

    • Structuring Routes

    • Routes with Parameters (/hello/:name)

    • Recap

  • Using MongoDB

    • Installing MongoDB Locally

    • Common Database Commands

    • CRUD Commands

    • GUI Tool: Robomongo

    • Using MongoDB in a Node.js Application

  • Build a RESTful Node API

    • What is REST?

    • Backend Services for our Angular Frontend

    • Sample Application

    • Getting Started

    • Starting the Server and Testing

    • Database and User Model

    • Express Router and Routes

    • Route Middleware

    • Creating the Basic Routes

    • Creating Routes for A Single Item

    • Conclusion

  • Node Authentication

    • Why Token Based Authentication Came to Be?

    • The Problems with Server Based Authentication

    • How Token Based Authentication Works

    • The Benefits of Tokens

    • JSON Web Tokens

    • Breaking Down a JSON Web Token

    • Authenticating Our Node.js API

    • Route to Get User Information

    • Modules to Help with Authentication

    • Conclusion

  • Starting Angular

    • The State of JavaScript Applications

    • Introduction

    • Important Angular Concepts

    • Setting Up An Angular Application

    • Creating and Processing a Form

    • Conclusion

    • ngRoute

    • Node Server for Our Routing Application

    • Sample Application

    • The HTML For Our App

    • Angular Application

    • Injecting Pages into the Main Layout

    • Configuring Routes

    • Configuring Views

    • Conclusion

  • Animating Angular Applications

    • Animating Our Routing Application

    • How Does the ngAnimate Module Work?

    • How Animations Are Applied

    • Directives that Use Animation

    • Animating Our Routing Application

    • CSS Animations and Positioning

    • Conclusion

  • MEAN Stack Application Structure

    • Sample Organization

    • Organizing Node.js - Backend

    • Organizing AngularJS - Frontend

    • Testing Our Newly Organized App

  • Angular Services to Access an API

    • Types of Angular Services

    • The $http Module

    • A Sample Angular Service

    • User Service

  • Angular Authentication

    • Hooking Into Our Node API

    • Authentication Service

    • The Entire Auth Service File (authService.js)

    • Conclusion

  • MEAN App: Users Management CRM

    • Setting Up the Application

    • Main Application

    • Login Page

    • Authentication

    • User Pages

    • Conclusion

    • Recap of the Process

    • Next Up

  • Deploying MEAN Applications

    • Great Node Hosts

    • Deploying to Heroku

    • Git Repository

    • Deploying Our User CRM App

    • View Our Application in Browser

    • Using a Current Heroku App

    • Using Your Own Domain

    • Conclusion

  • MEAN Development Workflow Tools

    • Sample MEAN App

    • Bower

    • Gulp