Skip to content

Commit

Permalink
confirm ::1 address works (#355)
Browse files Browse the repository at this point in the history
* confirm ::1 address works

* name of the script
  • Loading branch information
bahmutov authored Feb 24, 2023
1 parent f418050 commit 0e9984e
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ jobs:
- name: Run json-server test
run: npm run demo-json-server

- name: Run ::1 host example
run: npm run demo-ip6

release:
needs: ['tests1', 'tests2', 'tests-node-v18']
if: github.ref == 'refs/heads/master'
Expand Down
13 changes: 7 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,11 @@
"demo-commands": "node src/bin/start.js 'node test/server.js --port 8800' 8800 'node test/client --port 8800'",
"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'",
"demo-multiple-test-commands": "node src/bin/start.js 9000 'npm run message && npm run message2'",
"demo-json-server": "node src/bin/start.js 'json-server test/data.json' 3000 'echo json-server working'"
"demo-json-server": "node src/bin/start.js 'json-server test/data.json' 3000 'echo json-server working'",
"demo-ip6": "node src/bin/start.js 'node test/ip6.mjs' 8000 'echo server with ::1 working'"
},
"devDependencies": {
"@types/node": "^18.14.1",
"ban-sensitive-files": "1.9.7",
"chai": "4.2.0",
"cross-env": "7.0.2",
Expand Down
17 changes: 17 additions & 0 deletions test/ip6.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import http from 'node:http';

// Create a local server to receive data from
const server = http.createServer();

// Listen to the request event
server.on('request', (request, res) => {
console.log('server responding')
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({
data: 'Hello World!',
}));
});

server.listen(8000, '::1', () => {
console.log('server is listening on ::1:8000')
});

0 comments on commit 0e9984e

Please sign in to comment.