This is the repository made via a tutorial whose link is - Build and Deploy a Realtime Chat Application - Socket.io, Node.js, and React.js - JavaScript Mastery
npx create-react-app client
cd client && npm install --save react-router socket.io-client react-scroll-to-bottom react-emoji query-string
- Create another directory named 'server'
cd server && npm init -y
npm install --save cors nodemon express socket.io
- Remove all unnecessary files in client/src folder and create index.js and App.js. Copy the code
- In client/src/components, copy all the components found
- Components include
- Join
- Chat
- Input
- Infobar
- Messages and Message
- TextContainer
- In server create index.js, router.js and users.js
- Copy the code
- Login to Heroku and Netlify. Download Heroku cli and Netlify cli
- Create a new Heroku app
- In server folder do the following -
git init heroku git:remote -a heroku-app-name git add . git commit -m "commit message" git push heroku master
- Copy the heroku app server website link and paste it in client/src/components/Chat/Chat.js as
const ENDPOINT = 'https://link';
cd ../client && npm run build netlify deploy
- Make Publish Directory as ./build
netlify deploy --prod
and your react chat application is deployed successfully!!
npm i && npm start
for both client and server sude to start the development server