A hands-on project from Udemy: The Complete Node.js Developer Course (2nd Edition)

-
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