This project consists of a backend and a frontend. The backend is responsible for handling TCP/IP communication and device management, while the frontend provides a user interface for interacting with the devices.I use Google ,chatGPT , Stack overflow and other tools to write better code and for testing code and to understand problem. But I know how its working and its working in my Laptop.
Right now front will show only your data on screen beacuse we don't have real data (i commented down few fuctions which requied real time data),But you can test the data,just run test command (given in the last) to check backend with out run backend.
The backend, located in the backend_device_man_back
directory, supports TCP/IP communication, communicates with multiple devices simultaneously, and allows for future additions of communication protocols. It also includes unit tests and a stub to test TCP/IP communication.
The frontend, located in the frontend/device-management
directory, is a React application that provides a user interface for managing devices, displaying real-time data, and handling user interactions.
backend_device_man_back/
├── config/
│ └── config.env
├── database/
│ └── dbcollection.js
├── handlers/
│ └── TCPHandler.js
├── model/
│ └── deviceSchema.js
├── routes/
│ └── deviceRoutes.js
├── services/
│ └── communicationService.js
├── test/
│ ├── e2e/
│ │ └── server.test.js
│ ├── name/
│ └── communicationService.test.js
│ └── unit/
│ └── TCPHandler.test.js
├── app.js
└── index.js
frontend/device-management/
├── public/
├── src/
│ ├── components/
│ │ ├── DeviceForm.js
│ │ ├── DeviceList.js
│ │ ├── RealTimeData.js
│ ├── App.css
│ ├── App.js
│ ├── App.test.js
│ ├── index.css
│ ├── index.js
│ ├── logo.svg
│ ├── reportWebVitals.js
│ └── setupTests.js
├── .gitignore
├── package-lock.json
└── package.json
- Node.js
- npm (Node Package Manager)
- MongoDB "You have to change with your local database"
-
Navigate to the backend directory:
cd backend_device_man_back
-
Install the dependencies:
npm install
-
Create a
.env
file in theconfig
directory and add your environment variables:MONGO_URI=<your_mongodb_url>
-
Run the backend server:
npm run dev
-
Navigate to the frontend directory:
cd frontend/device-management
-
Install the dependencies:
npm install
-
Run the frontend development server:
npm start
Once both the backend and frontend servers are running, you can interact with the application by navigating to http://localhost:3000
in your web browser.
-
Run the backend tests:
npm test:run