MEAN Blueprints
eBook - ePub

MEAN Blueprints

  1. 336 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

MEAN Blueprints

About this book

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.

Tools to learn more effectively

Saving Books

Saving Books

Keyword Search

Keyword Search

Annotating Text

Annotating Text

Listen to it instead

Listen to it instead

Information

MEAN Blueprints


Table of Contents

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

MEAN Blueprints

Copyright © 2016 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: May 2016
Production reference: 1240516
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78355-394-5
www.packtpub.com

Credits

Author
Robert Onodi
Reviewer
Dan Shreim
Acquisition Editor
Rahul Nair
Content Development Editor
Mayur Pawanikar
Technical Editor
Vivek Arora
Copy Editor
Vikrant Phadke
Project Coordinator
Nidhi Joshi
Proofreader
Safis Editing
Indexer
Monica Mehta
Graphics
Disha Haria
Production Coordinator
Nilesh Mohite
Cover Work
Nilesh Mohite

About the Author

Robert O...

Table of contents

  1. MEAN Blueprints

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 990+ topics, we’ve got you covered! Learn about our mission
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more about Read Aloud
Yes! You can use the Perlego app on both iOS and Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app
Yes, you can access MEAN Blueprints by Robert Onodi in PDF and/or ePUB format, as well as other popular books in Computer Science & Web Programming. We have over one million books available in our catalogue for you to explore.