https://http-dog-posters.herokuapp.com/
The undisclosed brick and mortar store has decided it's time to go online! To be able to give all their customers the best experience, regardless if they're buying from their ph9one or their smart speaker they want an API to easily support and extend their offering.
REQUIREMENTS :
- There need to be at least one way for customers to interact with their new API
- Customers should be able to find available products
- Customers should be able to create a shopping cart
- Should be possible to create an order with a shopping cart or a single item
- Workers at the store should be able to mark orders as packed and shipped
"name": "frontend", "proxy": "http://localhost:5000" in frontend package.json
- set proxy in package.json (need to set the proxy in package.json to access to backend in the frontend)
- npm install axios
- use effect hook
- use reducer hook
- define reducer
- update fetch data
- get state from useReducer
- npm install react-bootstrap bootstrap version
- npm install react-router-bootstrap ...for LinkContainer
Don't forget to import Bootstrap in index.js import 'bootstrap/dist/css/bootstrap.min.css
- fetch product from backend
- create 3 columns for image, info, action
- npm install react-helmet-async
- <title>some title</title (changes tab title)
- create loading component
- use spinner component
- create message component
- create utils.js to define getError function
- npm install mongoose (MongoDB object modeling to connect with MongoDB)
- npm install dotenv (to load .env file in the node application)
- create Product model
- create User model
- create seed route
- use route in server.js
- seed sample product
-
create react context (to manage state globally)
-
define reducer
-
create store provider
-
implement add to cart button click handler
-
check exist item in the cart
-
check count in stock in backend
- create 2 columns
- display items list
- create action column
- click handler for inc/dec item
- click handler for remove item
- click handler for checkout
- create sign in form
- add email and password
- add sign-in button
-- npm i bcryptjs
- create signin api
- npm install jsonwebtoken
- define generateToken
-- npm install express-async-handler (you can catch error in the async function inside this. If there is an error in this function, you can handle it in the server tactics ----Saves you writing your own try/catch for async/await and passes error on to next)
-- npm install jsonwebtoken (sending a token along with the object in res.send)
-- add Advanced Rest Client in Chrome
- handle submit action
- save token in store and local storage
- show user name in header
-- npm i react-toastify (adding nicer notifications) App.js : import 'react-toastify/dist/ReactToastify.css' SigninPage.js : toast.error(getError(err));
- create form inputs
- handle save shipping address
- add checkout wizard bar
- create input forms
- handle submit
- create backend api
- create input form
- handle submit
- show cart items, payment and address
- handle place order action
- create order create api
- handle place order action
- create oder create api
-- when 'authorization: Bearer undefine', check localStorage to see if the user information is correctly stored. -- when taking out hard coded _id from data.js, check the schema. (it was _id: { type: String } when I get error message. take that out then it will generate objectID)
- create backend api for oder/:id
- fetch order api in frontend
- show order information in 2 columns
developer.paypal.com login / dashboard / use sandbox for testing
- generate paypal client id (developer.paypal.com login / dashboard / use sandbox for testing) copy client id and put it in .env
- create api to return client id in server.js -> app.get('/api/keys/paypal', (req, rest) => { res.send(process.env.PAYPAL_CLIENT_ID || 'sb'); });
- install react-paypal-js (in frontend folder) npm install @paypal/react-paypal-js
- use PayPalScriptProvider in index.js in index.js
- use usePayPalScriptReducer in Order page
- implement loadPayPalScript function
- render paypal button
- implement onApprove payment function
- create pay order api in backend
- create order page
- create order history api
- use api in the frontend9
- get user info from content
- show user information
- create user update api
- update user info
- add sidebar
- add search box
- show filters
- create api for searching products
- display results
- define protected route component
- define admin route component
- add menu for admin in header
- create dashboard ui
- implement backend api
- connect ui to backend
- create products list ui
- implement backend api
- fetch data
- create products button
- implement backend api
- handle on click
- create edit button
- create edit product ui
- display product info in the input boxes
- create edit product backend api
- handle update click
- create cloudinary account
- npm i cloudinary
- npm i streamifier
- npm i multer
- use the api key in env file
- handle upload file
- implement backend api to upload
- show delete button
- implement backend api
- handle on click
- create order list page
- implement backend api
- fetch and display orders
- add ship button
- handle click action
- implement backend api for shipping
- add delete button (orderListPage)
- handle click action
- implement backend api for delete (orderRouter)
- create user list page
- implement backend api
- fetch and display users
- create edit button
- create edit product ui
- display product info in the input boxes
- implement backend api
- handle edit click
- add delete button
- handle click action
- implement backend api for delete
- create and config node project - npm init (root directory) add in package.json (root) "scripts": { "build": "cd backend && npm install && cd ../frontend && npm install && npm run build", "start": "node backend/server.js", }
- serve build folder in frontend folder - npm run build(root)
- create heroku account
- connect it to github
- create mongodb atlas database
- set database connection in heroku env variables
- copy .env in backend and paste in the root directory
- npm start (root) - check if the app is running on the localhost
- commit and push