-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(examples): update the nginx cluster example
Related: #3778 Reference: http://nginx.org/en/docs/http/ngx_http_upstream_module.html#hash
- Loading branch information
1 parent
10aafbb
commit 0d10e61
Showing
7 changed files
with
66 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM node:14-alpine | ||
|
||
# Create app directory | ||
RUN mkdir -p /usr/src/app | ||
WORKDIR /usr/src/app | ||
|
||
# Install app dependencies | ||
COPY package.json /usr/src/app/ | ||
RUN npm install --prod | ||
|
||
# Bundle app source | ||
COPY . /usr/src/app | ||
|
||
EXPOSE 3000 | ||
CMD [ "npm", "start" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const socket = require('socket.io-client')('ws://nginx'); | ||
|
||
socket.on('connect', () => { | ||
console.log('connected'); | ||
}); | ||
|
||
socket.on('my-name-is', (serverName) => { | ||
console.log(`connected to ${serverName}`); | ||
}); | ||
|
||
socket.on('disconnect', (reason) => { | ||
console.log(`disconnected due to ${reason}`); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "socket.io-chat", | ||
"version": "0.0.0", | ||
"description": "A simple chat client using socket.io", | ||
"main": "index.js", | ||
"author": "Grant Timmerman", | ||
"private": true, | ||
"license": "MIT", | ||
"dependencies": { | ||
"socket.io-client": "^2.4.0" | ||
}, | ||
"scripts": { | ||
"start": "node index.js" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters