Untitled
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'); });
Leave a Comment