Created
November 11, 2020 21:48
-
-
Save tedsuo/02b38a06c13d5279fa76adc2251cc10a to your computer and use it in GitHub Desktop.
node_basic_client.js
This file contains hidden or 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
| const http = require('http'); | |
| function makeRequest() { | |
| http.get({ | |
| host: 'localhost', | |
| port: 9000, | |
| path: '/hello', | |
| }, (response) => { | |
| const body = []; | |
| response.on('data', (chunk) => body.push(chunk)); | |
| response.on('end', () => { | |
| console.log(body.toString()); | |
| }); | |
| }); | |
| } | |
| for (let i = 0; i < 5; i++) { | |
| makeRequest(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment