Book Image

Building an E-Commerce Application with MEAN

By : Adrian Mejia
Book Image

Building an E-Commerce Application with MEAN

By: Adrian Mejia

Overview of this book

<p>MEAN stands for MongoDB, Express, AngularJS, and Node.js. It is a combination of a NoSQL database, MongoDB, with a couple of JavaScript web application frameworks, namely Express.js and Angular.js. These run on Node.js.</p> <p>There is always an ever-growing list of requirements while designing an e-commerce application, which needs to be flexible enough for easy adaptation. The MEAN stack allows you to meet those requirements on time and build responsive applications using JavaScript.</p> <p>This book will show you how to create your own e-commerce application using the MEAN stack. It will take you step by step through the parallel process of learning and building. It will also teach you to develop a production-ready, high-quality e-commerce site from scratch and will provide the knowledge you need to extend your own features to the e-commerce site.</p> <p>This book starts with a short introduction to the MEAN stack, followed by a step-by-step guide on how to build a store with AngularJS, set up a database with MongoDB, create a REST API, and wire AngularJS. It also shows you how to manage user authentication and authorization, check multiple payment platforms, add products’ search and navigation, deploy a production-ready e-commerce site, and finally add your own high-quality feature to the site.</p> <p>By the end of the book, you will be able to build and use your own e-commerce app in the real world and will also be able to add your own new features to it.</p>
Table of Contents (17 chapters)
Building an E-Commerce Application with MEAN
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Setting up the shopping cart


One of the main advantages of developing on open source technology is that we don't have to reinvent the wheel with every feature. We first look if there's any module that already does what we want to accomplish, before we start it ourselves, from scratch. That's true in the case of the shopping cart; we are going to use the already available module: ngCart.

Installing ngCart

The ngCart module provides the following directives and services that we need to get started with the shopping cart:

  1. It renders an Add to cart button: <ngcart-addtocart id="{{item.id}}" name="{{item.name}}" price="{{item.price}}"></ngcart-addtocart>.

  2. Renders a shopping cart: <ngcart-cart></ngcart-cart>.

  3. Shows the cart summary: <ngcart-summary></ngcart-summary>.

  4. Renders the checkout buttons for PayPal and other HTTP services: <ngcart-checkout service="http" settings="{url:'/checkout' }"></ngcart-checkout>.

We are going to use bower to quickly install...