mani_2003
v1.0.3
Published
π Showroom Management System This project demonstrates how to organize cars, salespersons, and showrooms into separate JavaScript modules inside a `details` folder, and then import them into a main `index.js` file.
Readme
π Showroom Management System
This project demonstrates how to organize cars, salespersons, and showrooms into separate JavaScript modules inside a details folder, and then import them into a main index.js file.
π Project Structure project/ βββ details/ β βββ cars.js β βββ salespersons.js β βββ showroom.js βββ index.js βββ package.json βββ README.md
π Files
details/cars.js
- Exports an array of cars
- Function: getCarsByShowroomId(showroomId) details/salespersons.js
- Exports an array of salespersons
- Function: getSalespersonsByShowroomId(showroomId) details/showroom.js
- Exports an array of showrooms
- Function: getShowroomById(id) index.js
- Imports everything from the details folder
- Demonstrates usage of all arrays and functions
βοΈ Installation & Setup
- Clone this repository: git clone https://github.com/your-username/showroom-management-system.git cd showroom-management-system
- Install Node.js (if not already installed): Download from https://nodejs.org/
- Initialize the project: npm init -y
- Enable ES Modules by adding this to package.json: { "type": "module" }
- Run the project: node index.js
βΆοΈ Example Output
Cars: [ ... ] Salespersons: [ ... ] Showrooms: [ ... ]
Cars in Showroom 1: [Tesla Model S, BMW X5] Cars in Showroom 2: [Toyota Camry, Audi A4]
Showroom 1 Details: Super Cars Showroom Showroom 2 Details: Luxury Rides Showroom 3 Details: Affordable Wheels
Salespersons in Showroom 3: Mr. Arjun
Showroom: Super Cars Showroom (Chennai) Salespersons: Mr. Rajesh Cars: Tesla Model S, BMW X5
Showroom: Luxury Rides (Bangalore) Salespersons: Ms. Priya Cars: Toyota Camry, Audi A4
Showroom: Affordable Wheels (Hyderabad) Salespersons: Mr. Arjun Cars: Hyundai Creta, Kia Seltos
π Key Learnings
- Split code into modular files
- Use import/export syntax
- Organize code like a mini npm package
- Filter and map data easily
π Future Improvements
- Add a function to search cars by brand
- Add a function to filter salespersons by experience
- Convert this into a reusable npm package
