MEAN Blueprints

Book description

Unlock the power of the MEAN stack by creating attractive and real-world projects

About This Book

  • Build six optimum end-to-end web applications using the M.E.A.N stack
  • Follow the advanced Angular.js 2 application structure to build more scalable and maintainable apps
  • Integrate an authorization system into your application and reuse existing code from projects

Who This Book Is For

If you are a web developer with a basic understanding of the MEAN stack, experience in developing applications with JavaScript, and basic experience with NoSQL databases, then this book is for you.

What You Will Learn

  • Build modern, end-to-end web applications by employing the full stack web development solution of MEAN
  • Learn NoSQL databases and separate the client logic from the server code
  • Build a complex application from start to finish and work with monetary data in MongoDB
  • Handle a multi-user type system and authorize your users to access control list
  • Implement a chat application from scratch using Socket.IO
  • Create distributed applications and use the power of server-side rendering in your applications
  • Extend a project with a real-time bidding system using WebSockets

In Detail

The MEAN stack is a combination of the most popular web development frameworks available - MongoDB, Angular, Express, and Node.js used together to offer a powerful and comprehensive full stack web development solution. It is the modern day web dev alternative to the old LAMP stack. It works by allowing AngularJS to handle the front end, and selecting Mongo, Express, and Node to handle the back-end development, which makes increasing sense to forward-thinking web developers. The MEAN stack is great if you want to prototype complex web applications.

This book will enable you to build a better foundation for your AngularJS apps. Each chapter covers a complete, single, advanced end-to-end project. You'll learn how to build complex real-life applications with the MEAN stack and few more advanced projects. You will become familiar with WebSockets and build real-time web applications, as well as create auto-destructing entities. Later, we will combine server-side rendering techniques with a single page application approach. You'll build a fun project and see how to work with monetary data in Mongo. You will also find out how to a build real-time e-commerce application.

By the end of this book, you will be a lot more confident in developing real-time, complex web applications using the MEAN stack.

Style and approach

This book is filled with independent hands-on projects that teach you how to build real-life end-to-end complex web applications using the MEAN stack.

Table of contents

  1. MEAN Blueprints
    1. Table of Contents
    2. MEAN Blueprints
    3. Credits
    4. About the Author
    5. About the Reviewer
    6. www.PacktPub.com
      1. eBooks, discount offers, and more
        1. Why subscribe?
    7. Preface
      1. The idea behind the book
      2. A little bit of twist
      3. What this book covers
      4. What you need for this book
      5. Who this book is for
      6. Conventions
      7. Reader feedback
      8. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    8. 1. Contact Manager
      1. Setting up the base application
        1. Folder structure
        2. Server-side package.json
        3. The first application file
        4. Creating the Express configuration file
        5. Setting up mocha for testing
        6. Setting up Mongoose
      2. Managing contacts
        1. Creating the contact mongoose schema
        2. Describing the contact route
          1. Creating a contact
          2. Getting contacts
          3. Getting a contact by ID
          4. Updating a contact
          5. Removing a contact
          6. Running our tests
        3. Implementing the contact routes
          1. Adding all endpoints
          2. Finding a contact by ID
          3. Getting contact information
          4. Updating a contact
          5. Removing a contact
        4. Running the contact test
      3. Securing your application routes
        1. Describing the password helper
        2. Implementing the password helper
        3. Creating the user Mongoose schema
          1. Describing the authentication method from the user model
          2. Implementing the authentication method
        4. Authentication routes
          1. Describing the authentication routes
          2. Integrating Passport
          3. Implementing the authentication routes
        5. Restricting access to contacts routes
      4. Integrating Angular 2 into our application
      5. Granting access to our application
        1. AuthService
        2. User sign-in component
        3. Custom HTTP service
      6. The Contact module
        1. Contact service
        2. Contact component
        3. List contacts component
        4. Creating a contact component
        5. Editing an existing contact
      7. Finishing touch
      8. Summary
    9. 2. Expense Tracker
      1. Setting up the base application
        1. Installing the dependencies
        2. Creating the base configuration files
        3. Creating the main server.js file
      2. Setting up the user section
        1. Describing the user model
        2. Implementing the user model
      3. Authenticating users
        1. Describing the authentication strategies
        2. Implementing the token generation
        3. Persisting tokens in MongoDB
        4. Authentication using HTTP Basic
        5. Adding authentication routes
        6. Verifying users using bearer authentication
          1. Bearer strategy
          2. Protecting resources using tokens
      4. Tracking expenses
        1. Monetary values
        2. The category model
        3. Categories routes
          1. Getting the category by ID
          2. Creating a category
          3. Getting one and all categories
          4. Updating and deleting a category
        4. Defining the expense model
        5. Describing the expense module functionality
        6. CRUD operations for expenses
          1. Create expense
          2. Get expense by ID
          3. Get one expense
          4. Get all expenses
          5. Update expense
          6. Delete expense
        7. Getting the expense balance
      5. Implementing the Angular client application
        1. Bootstrapping the project
      6. Registering users
        1. The auth service
        2. Register component
      7. Sign-in-user component
      8. Common functionalities
        1. Custom HTTP service
        2. Using a single export file
      9. The categories module
        1. Category service
        2. The categories component
        3. Create a new category
        4. List all categories
        5. The category component
      10. The expenses module
        1. Expense service
        2. Filter expenses
        3. Add a new expense
        4. List expenses
        5. Display balance
        6. Expenses component
      11. Summary
    10. 3. Job Board
      1. Setting up the base application
      2. Modifying the user backend
        1. Modifying the user model
        2. An authorization policy
      3. The company backend module
        1. The company model
        2. The company controller
          1. Creating a company
          2. Getting a company by ID
          3. Getting all companies
          4. Updating a company
          5. Adding a company member
          6. Removing a company member
        3. Company routes
      4. The job backend module
        1. The job model
        2. Job controller
          1. Adding a new job for a company
          2. Finding a job by ID
          3. Getting all jobs
          4. Updating a specific job
        3. Job routes
          1. Getting one and all jobs
          2. Creating a route
          3. Updating a route
      5. Job applications
        1. The application model
        2. Controller logic
          1. Applying for a job
          2. Finding a given application by ID
          3. Getting all job applications
          4. Updating an application
          5. Removing an application from a job
      6. Creating a new company
        1. The company service
        2. Creating a company component
      7. Displaying companies
      8. The job module
        1. The job service
        2. The job base component
        3. The jobs component
        4. The job list component
        5. Job details
        6. Adding new jobs
      9. Company details
      10. User profile
        1. Profile backend
        2. Synchronizing profile data
        3. Editing profile data
        4. The profile block component
        5. Extra models
      11. Summary
    11. 4. Chat Application
      1. Setting up the base application
      2. Modifying the user model
      3. The message history data model
        1. The thread schema
        2. The message schema
      4. Thread backend
        1. Thread controller
        2. Defining routes
        3. Message controller
      5. Backend chat service
        1. Chat service implementation
        2. Instant messaging module
      6. Bootstrapping the Angular app
        1. The boot file
        2. App component
      7. Custom data types
        1. User type
        2. Thread type
        3. Message type
      8. Application services
        1. User service
        2. The thread service
        3. The message service
      9. The chat component
      10. The user list component
      11. Displaying threads
        1. Thread component
        2. Thread list component
      12. Messaging
        1. Sending messages
        2. The message component
        3. The message list component
      13. Summary
    12. 5. E-commerce Application
      1. Setting up the base application
      2. Data modeling
        1. Custom money data type
        2. The product model
        3. The order model
        4. The inventory model
      3. The core Service Layer
        1. The product catalog
        2. The inventory manager
        3. Shopping cart
      4. The Auth micro app
        1. Defining the class
        2. The controller
      5. Exposing an API
        1. The Api class
        2. Product controller
        3. Product router
      6. Shared resources
      7. The admin section
        1. The admin micro app
        2. Changing the auth module
        3. Products administration
          1. The product service
          2. List products
          3. The main product component
          4. Add and edit a product
        4. Order handling
          1. Retrieving orders
          2. View and update orders
      8. Building the Storefront
        1. Storefront micro app
        2. Storefront pages
          1. Main layout
          2. List products
      9. Summary
    13. 6. Auction Application
      1. Setting up the base app
      2. What we are building
      3. Data modeling
        1. Auction
        2. Bidder
      4. Auction backend
        1. The Mediator
        2. Auction manager
        3. Auctioneer
        4. Using the service from controller
        5. Accessing data from the e-commerce API
        6. E-commerce client service
      5. Frontend services
        1. Auction service
        2. The socket service
        3. The bid service
        4. The bidder service
      6. The Auction module
        1. The base component
        2. The auction list
        3. The detail page
      7. The bid module
        1. Listing bids
        2. The bid component
      8. Summary
    14. Index

Product information

  • Title: MEAN Blueprints
  • Author(s): Robert Onodi
  • Release date: May 2016
  • Publisher(s): Packt Publishing
  • ISBN: 9781783553945