# IMChatProject-Golang **Repository Path**: gyan71/imchat-project ## Basic Information - **Project Name**: IMChatProject-Golang - **Description**: golang练手项目1——线上聊天室 - **Primary Language**: Go - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2023-06-28 - **Last Updated**: 2024-03-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #### **Project Name** Golang Hands-on Project 1 - Online Chatroom #### **Project Description** Online Chatroom is a hands-on project written in Golang. It allows users to register an account, log in, and chat with other online users. The basic layout of the project's frontend is conceived by the author, while the specific code implementation is done using ChatGPT 3.5. The backend utilizes the Gin framework and employs WebSocket communication. Access to the chat interface requires login authentication middleware for verification. #### **Features** - User registration and login: Users can register a new account and use their credentials to log in to the system. - User avatars: Currently, the project randomly assigns avatars upon user registration and does not include a feature for custom avatars. - Online chatting: Logged-in users can engage in real-time chat with other online users. - Non-persistent chat history: The system does not save user chat records; it serves as a message relay station. #### **Tech Stack** - Golang - Gin framework - ChatGPT 3.5 - WebSocket communication #### **Installation and Execution** > Make sure that MySQL service is installed with a version compatible with the Golang driver version downloaded, and the corresponding database and tables have been successfully created. 1. Clone the project to your local machine: ``` shellCopy codeshellCopy code git clone https://gitee.com/gyan71/imchat-project.git ``` 1. Navigate to the project directory: ``` shellCopy codeshellCopy code cd your-project-directory ``` 1. Install dependencies: ``` shellCopy codeshellCopy code go mod download ``` 1. Modify the configuration file `config.yaml`: Edit the corresponding parameters in the file. Usually, only the username and password for MySQL need to be modified: ``` yamlCopy codemysql: host: "127.0.0.1" port: 3306 user: "your user name" password: "your password" ``` 1. Run the project: ``` shellCopy codeshellCopy code go run main.go ``` 1. Access `http://localhost:8080/login` in your browser to register an account for the online chatroom. Once registered successfully, you can log in and enter the chatroom homepage. #### **License** This project is licensed under the MIT License. For more information, please refer to the LICENSE file.