const http = require("http"); const server = http.createServer((req, res) => { let body = ""; req.on("data", (chunk) => { body += chunk; }); req.on("end", () => { const regexReg = /(.*?)<\/NS1:register>/; const regexRek = /(.*?)<\/NS1:norek>/; let match = body.match(regexReg); const register = match ? match[1] : null; match = body.match(regexRek); const rekening = match ? match[1] : null; if (req.url === "/BukaRekening" && req.method === "POST") { let xmlInquiryResponse = ""; xmlInquiryResponse = ` false 00 Add/Update rekening register: ` + register + ` berhasil. `; res.writeHead(200, { "Content-Type": "text/xml; charset=utf-8" }); res.end(xmlInquiryResponse); } else { res.writeHead(404, { "Content-Type": "text/plain" }); res.end("Not found"); } }); }); server.listen(3096, () => { console.log( "SOAP dummy BPJS TK Individual running at http://0.0.0.0:3096/BukaRekening", ); });