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