This is a simple example of how to use socket.io with mongodb.
- Clone the repository
- Install dependencies:
npm install
for both client and server - Create a
.env
file in theserver
directory of the project and add the following variables:
MONGODB_URI=<insert your mongodb atlas uri>
- Run the server:
npm run start
in theserver
directory - Run the client:
npm run start
in theclient
directory
- Open the client in multiple different tabs
- Insert a message in one of the tabs
- All other tabs should receive the message