A hands-on project from Udemy: The Complete Node.js Developer Course (2nd Edition)
![udemy-chatapp](https://private-user-images.githubusercontent.com/18576075/270195058-bc9f31de-f970-4a01-b46c-c56184eca10e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQyODM0NTEsIm5iZiI6MTcyNDI4MzE1MSwicGF0aCI6Ii8xODU3NjA3NS8yNzAxOTUwNTgtYmM5ZjMxZGUtZjk3MC00YTAxLWI0NmMtYzU2MTg0ZWNhMTBlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIxVDIzMzIzMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTlhOTRkNDU5MjYyZDNmODExYTZhZmE1ZmY3YjNlZTNiZWY3MjczN2MzZTdjMjEzYTU3MDQ2ZWQxM2U1M2I3NjUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.wzR_tmeTni7nhn8Dr-tdUU8y6QFV2MKsAlZlyH1XnCQ)
-
Join a specified room to chat
-
Send the geographical location to other users in the room if permission is granted
-
Automatically scroll down upon receiving a new message
-
Responsive web design (RWD)
-
Colorized the user and the administrator's messages to set them apart from the rest
-
Save text messages in the cloud so that user won't miss any messages of the day
-
Add nyc (the command-line-client for Istanbul) for checking the test coverage and generating the test report
Follow the instructions below to set up the environment and run this project on your local machine
- Node.js
- MongoDB
- Download ZIP or clone this repo
> git clone https://github.com/rubychi/udemy-chatapp.git
- Start a MongoDB server running on port 27017
> mongod
- Install dependencies via NPM
> npm install
- Create your own config.json to securely store credentials inside \server\config
{
"test": {
"PORT": "3000",
"MONGODB_URI": "mongodb://localhost:27017/ChatAppTest"
},
"development": {
"PORT": "3000",
"MONGODB_URI": "mongodb://localhost:27017/ChatApp"
}
}
- Back to the root directory and type the below command to start the server and the service
> npm run dev-watch
- See it up and running on http://localhost:3000
If you just want to run the tests, type in the command below
> npm run test-watch
For checking the test coverage and generating the html report:
> npm run test-report
- Deploy to Heroku
> heroku create
> git push heroku master
> heroku addons:create mongolab:sandbox
- Set up config vars
> heroku config:set
MONGODB_URI=[Your MongoDB URI]
- Open the app in the browser
> heroku open
Click this button to deploy to your Heroku server
- jquery
- mustache
- express
- mongodb
- mongoose
- compression
- helmet
- socket.io
- lodash
- moment
- mocha
- nyc
- Send an event to everybody in the room 'The Office Fans'
io.emit -> io.to('The Office Fans').emit
- Send an event to everybody in the room 'The Office Fans' except for the current user
socket.broadcast.emit -> socket.broadcast.to('The Office Fans').emit
- Send an event to a specific user
socket.emit