This is a simple CLI-based chat application that allows users to create chat rooms and join existing ones. The application is built using Node.js, Express, and Socket.io.
- Create a new chat room with a unique ID.
- Join an existing chat room using the room ID.
- Send and receive real-time messages.
- Notify users when someone joins or leaves the chat.
- Node.js (v14 or higher)
-
Clone the repository:
git clone https://github.com/your-username/cli-chat-app.git cd cli-chat-app
-
Install the dependencies:
npm install
-
Start the server:
node server.js
-
In a separate terminal, start the client:
node client.js
-
Run the client script:
node client.js
-
Select an option:
- Enter
1
to join an existing chat room. - Enter
2
to create a new chat room.
- Enter
-
Follow the prompts to enter the room ID (if joining a chat) and your username.
-
Start chatting! Type your messages and press Enter to send them.
cli-chat-app/
├── client.js
├── server.js
├── package.json
├── package-lock.json
└── .gitignore
client.js
: The CLI client script for joining and creating chat rooms.server.js
: The server script handling Socket.io connections and message broadcasting.package.json
: The project’s package file.package-lock.json
: The lockfile generated by npm.