This is bootstrap continuation from: Getting Started ExpressJS 2020
Alternative way for passing argument instead of global variable.
NPM install
# install socket.io
npm i -S socket.io
Pass io as argument
app.js
Becomes
Basic understanding for passing an argument io
, and later on, refactoring the code.
www
Becomes
Git commit: Pass io as argument
git add app.js bin/www
git commit -m "Pass io as argument"
Integrating socket.io
Git commit: Integrating socket.io
git add app.js views/partials/script.hbs
git commit -m "Integrating socket.io"
Optional Templates Examples
Template: Chat
u-box.less
Manual: Chat
- Open Index with different tabs
- Type something and see messages accumulate
Template: Routes
Routes
Style
Layout
Curl POST
terminal: chmod +x curl-women.sh
terminal: ./curl-women.sh
terminal: chmod +x curl-girls.sh
terminal: ./curl-girls.sh
Open Pages
Manual: Routes
- Open two pages: Women and Girls in the browser
- Use terminal to POST a JSON data with curl, for example:
./curl-women.sh
- And see new message appear in the chat.
Sources