Computer scienceBackendNode.jsCore ConceptsInternal modulesHTTP serverhttp module

Sending requests

Get request puzzle

Report a typo

Sort the code fragments to make a GET request that sends messages to the console with the server response.

Put the items in the correct order
const http = require('node:http');
http.get('http://api-server.com/', (res) => {
});
let response = '';
res.on('data', (chunk) => { response += chunk; });
res.on('end', () => console.log(JSON.parse(response)));
___

Create a free account to access the full topic