This is an online shop web application built with Node.js. It provides a platform for users to browse and purchase products. The application uses Mongoose for data models, Express for routing and handling requests and responses, and EJS as the view engine. It follows the Model-View-Controller (MVC) architectural pattern.
- Clone the repository:
git clone https://github.com/maryamalsadat-tabatabaei/Node.js-Online-Shop-Web-App.git
- Navigate to the project directory:
cd Node.js-Online-Shop-Web-App
- Install dependencies:
npm install
- Start the application:
npm start
- Open your browser and visit http://localhost:3000
To configure the project, create .env file and add the following variables:
- DB_PASSWORD
- MONGO_DB_PASSWORD
- MONGO_DB_USER
- MONGO_DB_COLLECTION
- MONGO_DB_PORT
- SENDGRID_API_KEY
- SRRIPE_API_KEY
-
The online shop web app provides the following features:
- User Authentication: Users can log in to their accounts to access personalized features.
- Product Browsing: Users can view all products available in the shop.
- Product Details: Users can access detailed information about each product.
- Cart Functionality: Users can add products to their cart for later purchase.
- Ordering: Users can place orders for the products in their cart and receive an invoice.
-
Admin users have additional capabilities:
- Product Management: Admins can add, edit, and delete products from the shop.
GET /admin/products
: Get all the admin products.
GET /admin/add-product
: Get the add product page.
POST /admin/add-product
: Save a product.
GET /admin/edit-product/:productId
: Retrieve the product.
POST /admin/edit-product
: Update the product.
POST /admin/delete-product
: Delete product.
GET /product-list
: Get all the products.
GET /
: Get all the products.
GET /product-list/:productId
: Get the product details.
GET /cart
: Get the cart products.
POST /cart
: Delete the products from the card and put them in the order list.
POSt /cart-delete-item
: Delete the product from the cart.
GET /orders
: Get the ordered products.
POST /create-order
: Order the products.
GET /checkout
: Checkout the product order.
The following dependencies are used in this application:
express
: Fast, unopinionated, minimalist web framework for Node.js.mongoose
: Elegant MongoDB object modeling for Node.js.ejs
: Embedded JavaScript templates for rendering views.body-parser
: Node.js body parsing middleware.
This project is based on Maximilian Schwarzmüller's tutorial on Udemy Complete Node.js. I have made modifications and I built upon that foundation to extend the project's functionality and address specific requirements. However, the core concept and initial implementation were inspired by the course and the work of the original author.