/angular2-node-express-mongo-ngBookStore

A sample e-commerce application using Angular 2, Express, Node.js and MongoDB. The project demonstrates how to build both the user section and admin section.

Primary LanguageTypeScript

NgBookStore

This e-commerce Single Page Application project is a built on the MEAN Stack (Mongo, Express, Angular 2, Node) in order to help anyone who is trying to learn how these Javascript technologies work together. It shows how to do CRUD operation with Mongo DB and nested router control for Angular 2.

For simplicy, authentication is not implemented. I will be doing a separate project to demonstrate that feature soon.

User Section

screen shot 2017-01-15 at 11 34 34 pm

screen shot 2017-01-15 at 11 36 23 pm

screen shot 2017-01-15 at 11 50 38 pm

Admin Section

screen shot 2017-01-15 at 11 50 54 pm

screen shot 2017-01-15 at 11 37 45 pm

Development server

Navigate to the project folder and run npm install. Make sure you have mongo installed on your machine or simply do sudo npm install -g mongo and create a local database and a collection called ngBookStore and books respectively.

Creat a database

use ngBookStore

Create a collection

db.createCollection('books')

Run npm install in the backend folder and do node server.js before navigating back to the project folder and run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the -prod flag for a production build.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via Protractor. Before running the tests make sure you are serving the app via ng serve.