This is a tutorial on how to setup a basic chat app using NodeJS and Socket.IO and deploying and hosting it successfully on Azure.
This basic app is a sample for a group chat which can have multiple participants and offers a place where these participants can chat.
The app is hosted on Azure at
http://nodegroupchat.azurewebsites.net/
This repository can be used for learning purpose the same way i did.
If you have any query regarding this repository, I would be happy to reply back. You can connect with me on LinkedIn
The following technologies are used:
- Visual Studio Code (Code Editor of choice)
- NodeJS
- Socket.io
This installation guide is for Windows. But Mac and Linux can follow too for basic installation.
- Install Visual studio code or any code editor of choice.(The reason of choosing VS code is because of it's integration with Azure)
- Install NodeJS (install the LTS version for nodejs)
- /root
- public (contains all html, css and javascript code)
- index.js (contains the server-side code)
Once you have successfully installed NodeJS. To create the index.js, we are going to use the command
npm init
You can either select the default values or enter your add your own if you want to change.
Now, index.js will be created. Create a folder named public and create three files namely index.html, main.js and style.css
To install socket.io, run the command
npm install socket.io
You can also fork this repo and clone it to your pc locally. If you clone this repository, run this command to install the necessary dependencies.
npm install
Go to the /src folder for this application and run this command.
node index.js
Your app url is hosted on localhost:3000
.
Go to your browser of choice and go to the app url.
Enjoy chatting with your friends on your local devices by opening multiple browsers.
Firstly, install Azure App Serive
-
Follow these steps to deploy the app to Azure.
-
Follow the steps mentioned above to successfully create a CI/CD pipeline and deploy the app azure.
Note: The reason for attaching the steps guides is for easy understanding with Microsoft docs and it is maintained by Microsoft making it more trustable.
- This guide is created by Avichel Verma
- Main credits goes to Socket.io and Microsoft docs for their exceptionally guides.