const http = require('http'); const postData = JSON.stringify({ username: 'testuser', hash: 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', // empty string hash role: 'student' }); const options = { hostname: 'localhost', port: 3000, path: '/addUser', method: 'POST', headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(postData) } }; const req = http.request(options, (res) => { console.log(`Status: ${res.statusCode}`); console.log(`Headers: ${JSON.stringify(res.headers)}`); res.setEncoding('utf8'); res.on('data', (chunk) => { console.log(`Body: ${chunk}`); }); res.on('end', () => { console.log('No more data in response.'); }); }); req.on('error', (e) => { console.error(`Problem with request: ${e.message}`); }); req.write(postData); req.end();