Skip to content

Commit 4f1cc7d

Browse files
committed
update server sample to be compatible with Glitch #58
1 parent efebc1e commit 4f1cc7d

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

NodeServer/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const { createServer } = require('http');
44
const WebSocket = require('ws');
55

66
const app = express();
7+
const port = 3000;
78

89
const server = createServer(app);
910
const wss = new WebSocket.Server({ server });
@@ -34,6 +35,6 @@ wss.on('connection', function(ws) {
3435
});
3536
});
3637

37-
server.listen(8080, function() {
38-
console.log('Listening on http://localhost:8080');
38+
server.listen(port, function() {
39+
console.log(`Listening on http://localhost:${port}`);
3940
});

NodeServer/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
"start": "node index.js",
88
"test": "echo \"Error: no test specified\" && exit 1"
99
},
10+
"engines": {
11+
"node": "12.x"
12+
},
1013
"author": "",
1114
"license": "ISC",
1215
"dependencies": {

0 commit comments

Comments
 (0)