Skip to content

Commit 0e9984e

Browse files
authored
confirm ::1 address works (#355)
* confirm ::1 address works * name of the script
1 parent f418050 commit 0e9984e

File tree

4 files changed

+30
-7
lines changed

4 files changed

+30
-7
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ jobs:
9090
- name: Run json-server test
9191
run: npm run demo-json-server
9292

93+
- name: Run ::1 host example
94+
run: npm run demo-ip6
95+
9396
release:
9497
needs: ['tests1', 'tests2', 'tests-node-v18']
9598
if: github.ref == 'refs/heads/master'

package-lock.json

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,11 @@
100100
"demo-commands": "node src/bin/start.js 'node test/server.js --port 8800' 8800 'node test/client --port 8800'",
101101
"demo-multiple": "node src/bin/start.js 'node test/server --port 6000' 6000 'node test/server --port 6010' 6010 'curl http://127.0.0.1:6000 && curl http://127.0.0.1:6010'",
102102
"demo-multiple-test-commands": "node src/bin/start.js 9000 'npm run message && npm run message2'",
103-
"demo-json-server": "node src/bin/start.js 'json-server test/data.json' 3000 'echo json-server working'"
103+
"demo-json-server": "node src/bin/start.js 'json-server test/data.json' 3000 'echo json-server working'",
104+
"demo-ip6": "node src/bin/start.js 'node test/ip6.mjs' 8000 'echo server with ::1 working'"
104105
},
105106
"devDependencies": {
107+
"@types/node": "^18.14.1",
106108
"ban-sensitive-files": "1.9.7",
107109
"chai": "4.2.0",
108110
"cross-env": "7.0.2",

test/ip6.mjs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import http from 'node:http';
2+
3+
// Create a local server to receive data from
4+
const server = http.createServer();
5+
6+
// Listen to the request event
7+
server.on('request', (request, res) => {
8+
console.log('server responding')
9+
res.writeHead(200, { 'Content-Type': 'application/json' });
10+
res.end(JSON.stringify({
11+
data: 'Hello World!',
12+
}));
13+
});
14+
15+
server.listen(8000, '::1', () => {
16+
console.log('server is listening on ::1:8000')
17+
});

0 commit comments

Comments
 (0)