Skip to content

Commit fdd3a71

Browse files
committed
Run Locally Documentation
1 parent c67f7d3 commit fdd3a71

File tree

5 files changed

+135
-17
lines changed

5 files changed

+135
-17
lines changed

README.md

Lines changed: 124 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,136 @@
11
# JS AMAZONA
2+
# Amazona ECommerce Website
3+
![amazona](/frontend/images/jsamazona.jpg)
24

3-
Welcome to my coding course to build an ecommerce website like amazon. In this course you will learn the essential tools and skills to design, develop and deploy a fully-function website like amazon using Vanilla JavaScript, HTML5 and CSS3 in frontend and Node and MongoDB in backend.
5+
# JavaScript Tutorial - Full ECommerce in 7 Hours [2021]
46

5-
My name is Basir and I’ll be your instructor in this course. After 17 years of coding in international companies like ROI Vision in Montreal, I found my passion in teaching programming. For the last 5 years I have been tutoring 100 thousands students over my youtube channel, udemy courses and zoom online classes.
7+
Welcome to my React and Node tutorial to build a fully-functional e-commerce website exactly like amazon. Open your code editor and follow me for the next hours to build an e-commerce website using Vanilla JavaScript and Node.JS, ExpressJS and MongoDB.
68

7-
I designed this course for anyone seeking to develop a fully-functional ecommerce website like amazon. By the end of this course you’ll be able to design a responsive web template, implement a user-friendly frontend and build a scalable backend. Also you can deploy your website on cloud servers like Heroku and connect it to payment gateways like PayPal.
9+
## Watch YouTube Video
10+
[https://www.youtube.com/watch?v=N3FDyheHVMM](https://www.youtube.com/watch?v=N3FDyheHVMM)
811

9-
You need to open a code editor along with me and start coding throughout this course. I teach you:
12+
## Demo Website
1013

11-
- Web Design using HTML5, CSS3 including Semantic Elements, Flexbox, Grid System and Response Design.
12-
- Frontend Development by Pure JavaScript including ES6 Syntax, Rendering System, Single Page App, Libraries for Date Time, drawing chart and etc.
13-
- Backend Development using Node and MongoDB consist of ExpressJS, JWT Authentication, Mongoose object data modeling and more.
14+
- 👉 Heroku : [https://jsamazona.herokuapp.com](https://jsamazona.herokuapp.com)
15+
- 👉 AWS : [https://jsamazona.webacademy.pro](https://jsamazona.webacademy.pro)
1416

15-
This course is for non-coders or juniors who want to be a professional web developer to get a job in 22 million job opportunities around the world. No requirement is necessary for this course and having a passion for coding is enough.
1617

17-
Feel free to take a look at the course preview and enroll if it is along with your ambitions.
18+
## You Will Learn
1819

19-
# Table Of Content
20+
- HTML5 and CSS3: Semantic Elements, CSS Grid, Flexbox
21+
- JavaScript: ES6+, Array Functions, Rendering System
22+
- Node & Express: Web API, Body Parser, File Upload, JWT
23+
- MongoDB: Mongoose, Aggregation
24+
- Development: ESLint, Babel, Git, Github,
25+
- Deployment: Heroku
26+
- Watch React & Node Tutorial
27+
28+
## Run Locally
29+
30+
### 1. Clone repo
31+
32+
```
33+
$ git clone git@github.com:basir/node-javascript-ecommerce.git
34+
$ cd node-javascript-ecommerce
35+
```
36+
37+
### 2. Setup MongoDB
38+
- Download and Install it from [mongodb.com](https://www.mongodb.com/try/download/community)
39+
40+
### 3. Create .env file
41+
- Create .env file in project folder
42+
- Enter these lines to that:
43+
44+
```
45+
MONGODB_URL=mongodb://localhost/jsamazona
46+
JWT_SECRET=somethingsecret
47+
PAYPAL_CLIENT_ID=db
48+
```
49+
50+
### 4. Run Backend
51+
52+
```
53+
$ npm install
54+
$ npm run build
55+
$ npm start
56+
```
57+
58+
### 5. Run Frontend
59+
60+
```
61+
# open new terminal
62+
$ cd frontend
63+
$ npm install
64+
$ npm start
65+
```
66+
67+
### 6. Create Admin User
68+
69+
- Run this on chrome: http://localhost:5000/api/users/createadmin
70+
- Note admin email and password
71+
72+
### 7. Admin Login
73+
74+
- Run http://localhost:8080/#/signin
75+
- Enter admin email and password and click signin
76+
- Click Dashboard Link on Header Menu
77+
- Click Products on left sidebar
78+
- Click Create Product Button
79+
- Enter Product Information
80+
- Go to home page (http://localhost:8080) and test Ecommerce Website
81+
82+
## Support
83+
84+
- Q/A: https://webacademy.pro/amazona
85+
- Contact Instructor: [Basir](mailto:basir.jafarzadeh@gmail.com)
86+
87+
88+
# Features
89+
90+
1. Home Screen
91+
1. Static Web Page Design
92+
2. CSS Grid to create website layout
93+
3. Flexbox to shape product thumbnails and responsive design
94+
2. Product Screen
95+
1. create single page application
96+
2. Create buttons and add events to buttons
97+
3. Cart Screen
98+
1. Save and retrieve data in local storage
99+
2. Master in javascript array functions
100+
3. Use combo box and add event to it
101+
4. re-render screen based on changes in item count
102+
4. Sign-in and Register Screen
103+
1. Create dynamic form
104+
2. Input validation in frontend and backend
105+
3. Create web server using node.js
106+
4. Connect to Mongodb database
107+
5. Add registered user to the database
108+
6. Authenticate user based on email and password
109+
7. Using Jsonwebtoken to authorize users
110+
5. Shipping and Payment Screen
111+
1. Create wizard form to get user data in multiple steps
112+
2. Save user info in the local storage
113+
6. Place Order Screen
114+
1. Validate and create order in the database
115+
7. Order Screen
116+
1. Payment with paypal
117+
2. Show order state based on user and admin activities
118+
8. Profile Screen
119+
1. Create authenticated routes
120+
2. enable user to update their informations
121+
3. enable user to logout and clear local storage
122+
4. show list of orders to user and link it to details
123+
9. Dashboard Screen
124+
1. Create professional dashboard using pure CSS
125+
2. Using chart library to show sales information
126+
10. Order Screen
127+
1. Enable admin to mange orders
128+
2. show loading message and alert message
129+
11. Product Screen
130+
1. enable admin to manage products
131+
2. upload product images to server
132+
133+
# Lessons
20134

21135
1. Create Folder Structure
22136
1. create root folder as jsamazona

backend/routers/orderRouter.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ orderRouter.get(
4545
},
4646
},
4747
]);
48-
res.send({ users, orders, dailyOrders, productCategories });
48+
res.send({
49+
users,
50+
orders: orders.length === 0 ? [{ numOrders: 0, totalSales: 0 }] : orders,
51+
dailyOrders,
52+
productCategories,
53+
});
4954
})
5055
);
5156
orderRouter.get(

frontend/images/jsamazona.jpg

164 KB
Loading

frontend/src/srceens/OrderScreen.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@ const handlePayment = (clientId, totalPrice) => {
7373
const OrderScreen = {
7474
after_render: async () => {
7575
const request = parseRequestUrl();
76-
document
77-
.getElementById('deliver-order-button')
78-
.addEventListener('click', async () => {
76+
if (document.getElementById('deliver-order-button')) {
77+
document.addEventListener('click', async () => {
7978
showLoading();
8079
await deliverOrder(request.id);
8180
hideLoading();
8281
showMessage('Order Delivered.');
8382
rerender(OrderScreen);
8483
});
84+
}
8585
},
8686
render: async () => {
8787
const { isAdmin } = getUserInfo();

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
"main": "index.js",
66
"scripts": {
77
"start": "nodemon --watch backend --exec babel-node backend/server.js",
8-
"build": "rm -rf dest && babel backend -d dist",
8+
"build": "rm -rf dist && babel backend -d dist && cd frontend && npm install && npm run build",
99
"serve": "node dist/server.js",
10-
"heroku-prebuild": "cd frontend && npm install --dev",
11-
"heroku-postbuild": "npm run build && cd frontend && npm install && npm run build"
10+
"heroku-prebuild": "cd frontend && npm install --dev"
1211
},
1312
"repository": {
1413
"type": "git",

0 commit comments

Comments
 (0)