const http = require('http'); const data = JSON.stringify({ spaceId: null, onlyDue: false, }); const req = http.request({ hostname: 'localhost', port: 3000, path: '/api/pages/review-list', method: 'POST', headers: { 'Content-Type': 'application/json', 'Content-Length': data.length, // We need auth headers, maybe I can't easily test without a token } }, (res) => { let body = ''; res.on('data', chunk => body += chunk); res.on('end', () => console.log(body)); }); req.write(data); req.end();