This project aims to create a simple 2-page website using Node.js and an SQL database. The website will have features to fetch user data from an external API, delete user data from the database, and display user details with pagination and filtering options.
List of key features of the application:
- Fetch Users: Fetches bulk user data (around 50-100 records) from the RandomUser API and stores it in the database.
- Delete Users: Removes all user entries from the database.
- User Details: Displays user data in a table view on Page 2 with pagination and filtering options.
- The database table name will be determined during the setup process.
- The application will use a simple design for the user interface.
- Pagination will be implemented using a standard pagination numbered buttons.
- Filtering will be implemented based on specific columns such as name, age, etc.
Follow these steps to install, configure, and run the project:
-
Clone the repository.
-
Navigate to the backend directory.
-
Install dependencies using the following command:
npm install
-
Set up the database connection details in a
.env
file. -
Run the application using the following command:
npm run dev
-
Navigate to the frontend directory.
-
Install dependencies using the following command:
npm install
-
Run the react application using the following command:
npm start
To use the application:
- Access the homepage.
- Click the "Fetch Users" button to fetch user data from the RandomUser API and store it in the database.
- Click the "Delete Users" button to remove all user entries from the database.
- Click the "User Details" button to navigate to Page 2, where user data is displayed in a table view with pagination and filtering options.
- RandomUser API: Used to fetch user data.
-
POST /api/bulkcreate
: On recieving user data in bulk from the RandomUser API passed in the body as array of objects, stores it in the database[AWS RDS]. -
DELETE /api/bulkdelete
: Deletes all user entries from the table. -
GET /api
: Retrieves user data from the AWS RDS database and also has pagination option in queries and filter options .Following are the query parameters that you can pass in the API for the desired output
- page
- perPage
- name
- username
- address
- country
- image
- minAge
- maxAge
The project uses the following technologies:
- Node.js
- Express.js
- MySQL
- AWS RDS
- React
- Sequelize ORM