This is a simple chat server using Node.js, Express, and Socket.io.
- Node.js installed on your machine.
-
Clone the repository:
git clone cd evivve_assignment
-
Install dependencies:
npm install
-
Run the server:
npm start
The server will be running on http://localhost:8000.
- Open your browser and navigate to http://localhost:8000.
- You will see the chat application.
- Users can join different rooms and exchange messages.
The server is configured in the index.js
file.
app.get("/")
: Serves the HTML file for the chat application.io.on("connection")
: Handles socket connections, room joining, message sending, and disconnection events.
join room
: Allows users to join a specific chat room.chat message
: Sends and receives chat messages within a room.disconnect
: Handles user disconnection events.
The server is set to run on port 8000
by default. You can configure the port by setting the PORT
environment variable.