A Simple MEAN.js E-Commerce Application (Repo for Node + Express backend source code)
- 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
-
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
-
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/meanTodo?retryWrites=true&w=majority",
"dbUserName": "",
"dbPassword": ""
}
}
Sample Connection details for remote db instance
{
"env": {
"remoteDb": true,
"dbHost": "@meanTodo.0h5cq.mongodb.net/meanTodo?retryWrites=true&w=majority",
"dbUserName": "meanTodo",
"dbPassword": "meanTodo"
}
}
- Navigate to
\ngShop
and Runnpm install
. - Run
npm run serve
for a dev server using nodemon or Runnpm run start
. Navigate tohttp://localhost:3000/
.