Untitled
unknown
plain_text
a year ago
443 B
10
Indexable
const http = require('http');
function handleRequest(req, res) {
let callbackResponse = '';
req.on('data', chunk => {
callbackResponse += chunk;
});
req.on('end', () => {
console.log('Received data:', callbackResponse);
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Data received');
});
}
http.createServer(handleRequest).listen(3000, () => {
console.log('Server listening on port 3000');
});
Editor is loading...
Leave a Comment