Skip to content

Instantly share code, notes, and snippets.

@tedsuo
Created November 11, 2020 21:48
Show Gist options
  • Select an option

  • Save tedsuo/02b38a06c13d5279fa76adc2251cc10a to your computer and use it in GitHub Desktop.

Select an option

Save tedsuo/02b38a06c13d5279fa76adc2251cc10a to your computer and use it in GitHub Desktop.
node_basic_client.js
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