This project fulfills the requirements for the "Application Development Using Design Concepts" assignment via a Basic E-Commerce interface.
- Open up the terminal in this folder (
e:\live site). - Install packages (if you haven't) by running
npm install express cors. - Start the server by running
node server.js. - Open your browser and go to
http://localhost:3000.
The system contains pre-registered dummy accounts for testing login functionality:
- Admin: Username
admin, Passwordadmin123 - Customer: Username
user, Passwordpass123
This app uses standard Object-Oriented Programming principles inside server.js:
- Classes:
Product,User,Admin,Customer. - Objects: We instantiate items securely
new Product(1, "Laptop", 500, 10). - Encapsulation: Instead of modifying variables directly from the array, we use the
reduceStock()method of the Product class securely. - Inheritance: Both
AdminandCustomerclasses extend theUserclass to inherit login traits (usernameandpassword).
classDiagram
class User {
+username: String
+password: String
}
class Admin {
+role: String
}
class Customer {
+role: String
+cart: List~Product~
+addToCart(Product) Boolean
}
class Product {
+id: Number
+name: String
+price: Number
+stock: Number
+reduceStock(Number) Boolean
}
User <|-- Admin : Extends
User <|-- Customer : Extends
usecaseDiagram
actor Admin
actor Customer
rectangle "Shopping Cart Application" {
usecase "System Login" as UC1
usecase "View Inventory" as UC2
usecase "View Catalog" as UC3
usecase "Add to Cart" as UC4
}
Admin --> UC1
Admin --> UC2
Customer --> UC1
Customer --> UC3
Customer --> UC4
The system demonstrates logical flows switching between Admin and User scopes dynamically based on who is logged in. It's written entirely in standard <script> tags and basic HTML layout representing a standard first-year delivery package.