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.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyNDYwNjgsIm5iZiI6MTczOTI0NTc2OCwicGF0aCI6Ii8xODU3NjA3NS8yNzAxOTUwNTgtYmM5ZjMxZGUtZjk3MC00YTAxLWI0NmMtYzU2MTg0ZWNhMTBlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjExVDAzNDkyOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTY0Y2M0Y2ExN2IyMGNkYWUwNGM1ZTJhZDI2MzI4NWFkMzk4Y2Y0ODYxMzZjOTIwMjAyZDY5Mjc4Zjc2MDU5YmEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.qH8yLPDnaptTCSYuegtbdnk-3xlyVH9Ivc5516NEX4c)
-
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