A Simple MEAN.js E-Commerce Application
##Dependencies
- Angular-Cli: 8.3.27
- Typescript: 3.5.3
- Node: 11.15.0
- bootstrap: 4.5.0
- Angular Material: 8.2.3
- ngx-translate: 12.1.2
- ngx-toaster: 11.3.3
- Node: 12.16.2
- body-parser: 1.19.0
- express: 4.17.1
- mongoose: 5.9.22
- morgan: 1.10.0 - For logging HTTP requests
##Features
- Home page with list of products.
- Add items to Cart.
- Hover over cart icon to view items in the cart.
- Each item in cart will have a subtotal and grand total. On clicking checkout a mock of successful order is shown.
- Cart icon show a badge with number of items in cart.
- Mark items as Favorite.
- Hover over Favorite icon to view wish list in a popover.
- Clicking on links in footer will show route change and dummy pages.
- Translation support is added for localization/Internationalization.
- Toaster is added to let user know state of the action performed.
- 'Quantity' key is considered as max number of quantity a product can be added to cart. A info toaster will be shown when it exceeds the limit and the product will not be added to cart.
- State is maintained after the refresh.
-
Inventory Management with modules - Store, Products, Orders
-
Store module :- * Endpoint : /stores * method:
GET
,POST
,DELETE
* Operations: Add, Fetch all, Remove Store -
Products module :- * Endpoint : /products * method:
GET
,POST
,DELETE
,Patch
* Operations: Add, Fetch all, Fetch One, Update, Remove Product -
Orders module :- * Endpoint : /orders * method:
GET
,POST
,DELETE
* Operations: Create , Fetch all, Fetch One, Cancel Order -
All the operations can be done by using API from this Postman collection
-
Added products can be viewed in Frontend Application ngCart developed using Angular. Features available are listed in Repo of ngCart
Note: Product is fetched by making actual api call to endpoint
/products
and the placing orders are just a mock in Frontend App
-
Navigate to
environment.ts | environment.prod.ts
accordingly -
Change the value of the server to instance uri of backend application
- To run the backend app locally, clone the node.js app from repo and follow the steps from Readme.md
Sample server value in
environment
fileexport const environment = { production: false, server: "http://localhost:3000" };
- To connect to backend app hoisted in glitch online server (http://ngshop.glitch.me/products)
Sample server value in
environment
fileexport const environment = { production: false, server: "https://ngShop.glitch.me" };
-
MongoDB Hoisted in MongoDB Atlas
- Connect to Application URI -(mongodb+srv://ngShop:ngShop@ngshop.0h5cq.mongodb.net/ngShop?retryWrites=true&w=majority)
- Connect using Mongodb compass - (mongodb+srv://ngShop:ngShop@ngshop.0h5cq.mongodb.net/test)
- Connect with Mongo Shell - (mongo "mongodb+srv://ngshop.0h5cq.mongodb.net/" --username ngShop)
-
Config.json is used to provide db connection details
-
Open
<project_folder>\server\config\config.json
and
Sample Connection details for local db instance
{
"env": {
"remoteDb": false,
"dbHost": "127.0.0.1:27017/ngShop?retryWrites=true&w=majority",
"dbUserName": "",
"dbPassword": ""
}
}
Sample Connection details for remote db instance
{
"env": {
"remoteDb": true,
"dbHost": "@ngshop.0h5cq.mongodb.net/ngShop?retryWrites=true&w=majority",
"dbUserName": "ngShop",
"dbPassword": "ngShop"
}
}
- Navigate to project base folder in your local system and Run
npm install
. npm start
to start the angular and node.js application. This will start the angular application on port 4200 and node.js application on port 3000
-
# Note: Demo instance is connected to node.js app hoisted in (http://ngshop.glitch.me) and MongoDb hoisted in MongoDB atlas.
There will be a initial load time for the server to start in the hoisted environment. As it will be shut down due to inactivity. Angular app will be showing the spinner