Refactor: Initial code split into includes directory for modularity
- Reorganized backend logic by moving API, authentication, Docker, status, and WebSocket handling into separate modules (api.js, auth.js, docker.js, status.js, websocket.js) within ./includes/ - Converted codebase to ES modules with import/export syntax for modern JavaScript - Updated index.js to serve as main entry point, importing from ./includes/ - Reduced code duplication and improved readability with modularized functions - Ensured full functionality preservation, including Docker stats and WebSocket communication - Updated README to reflect new folder structure and ES module setup
This commit is contained in:
47
README.md
47
README.md
@ -45,14 +45,27 @@ Before setting up HyperMC Panel, ensure you have the following installed:
|
||||
2. **Install Dependencies**
|
||||
|
||||
```bash
|
||||
npm install
|
||||
npm install express cors ws dockerode node-fetch unirest dotenv
|
||||
```
|
||||
|
||||
3. **Set Up Environment Variables**
|
||||
|
||||
Create a `.env` file in the root directory and configure the required variables (see [Configuration](#configuration)).
|
||||
|
||||
4. **Start the Server**
|
||||
4. **Update package.json**
|
||||
|
||||
Ensure your `package.json` includes `"type": "module"` to enable ES modules:
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"start": "node index.js"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
5. **Start the Server**
|
||||
|
||||
```bash
|
||||
npm start
|
||||
@ -149,14 +162,38 @@ Replace placeholder values (e.g., `https://api.example.com`, `your_secure_secret
|
||||
│ │ └── styles.min.css # Compiled Tailwind CSS
|
||||
│ ├── favicon/ # Favicon assets
|
||||
│ └── index.html # Main HTML file
|
||||
├── includes/
|
||||
│ ├── api.js # API request handling
|
||||
│ ├── auth.js # Authentication and login link logic
|
||||
│ ├── docker.js # Docker-related functions
|
||||
│ ├── status.js # Connection status checking functions
|
||||
│ ├── websocket.js # WebSocket connection handling
|
||||
├── index.js # Main server entry point
|
||||
├── app.js # Frontend JavaScript logic
|
||||
├── server.js # Backend server logic
|
||||
├── .env # Environment variables (not tracked)
|
||||
├── package.json # Node.js dependencies
|
||||
└── README.md # Project documentation
|
||||
```
|
||||
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions are welcome! To contribute:
|
||||
|
||||
1. Fork the repository.
|
||||
2. Create a new branch (`git checkout -b feature/your-feature`).
|
||||
3. Make your changes and commit (`git commit -m "Add your feature"`).
|
||||
4. Push to your branch (`git push origin feature/your-feature`).
|
||||
5. Open a pull request on the [repository](https://git.ssh.surf/hypermc/panel).
|
||||
|
||||
Please ensure your code follows the project's coding style and includes appropriate tests.
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
|
||||
|
||||
## Acknowledgments
|
||||
|
||||
- **Chart.js**: For beautiful, responsive charts.
|
||||
- **xterm.js**: For the terminal interface.
|
||||
- **Tailwind CSS**: For the sleek, modern UI.
|
||||
@ -165,6 +202,4 @@ Replace placeholder values (e.g., `https://api.example.com`, `your_secure_secret
|
||||
|
||||
## Contact
|
||||
|
||||
For questions, issues, or suggestions, please open an issue on the [repository](https://git.ssh.surf/hypermc/panel) or contact the maintainer at [raven-scott.fyi](https://raven-scott.fyi).
|
||||
|
||||
Happy server management with HyperMC Panel! 🚀
|
||||
For questions, issues, or suggestions, please open an issue on the [repository](https://git.ssh.surf/hypermc/panel) or contact the maintainer at [raven-scott.fyi](https://raven-scott.fyi).
|
Reference in New Issue
Block a user