This is a simple e-commerce application built using Node.js and Express. The app includes basic functionalities for managing products and an admin panel for administration.
-
Clone the repository and navigate to the project directory.
-
Install the required dependencies:
npm install
-
Start the server:
-
node app.js
- The admin panel is located in the
admin-panel
directory. - Open
admin.html
in a browser to manage products and view logs.
-
GET /products
- Retrieves a list of all products.
-
POST /products/add
- Adds a new product. Requires the following fields in the request body:
id
name
description
price
- Adds a new product. Requires the following fields in the request body:
-
POST /products/delete
- Deletes a product. Requires the following field in the request body:
id
- Deletes a product. Requires the following field in the request body:
-
POST /products/update
- Updates an existing product. Requires the product details to be updated.
-
GET /user
- Retrieves user data, primarily admin details. This is a temporary endpoint for testing purposes.
-
POST /user/login
- Handles user login. Requires the following fields in the request body:
email
password
Note: This feature is currently not active.
- Handles user login. Requires the following fields in the request body:
-
Logging:
- All logs are saved to
db/log.json
.
- All logs are saved to
-
Storage:
- Products are stored in
db/products.json
. - Admin user data is stored in
db/users.json
.
- Products are stored in
- The application runs on
http://localhost:3000
. - JSON files are used as the data storage mechanism to keep the app simple and flexible for modifications.
- The project is intentionally basic and designed for future enhancements.
- Adding more robust authentication and user management features.
- Expanding functionality in the admin panel.
- Transitioning from JSON to a database for better scalability.