const http = require("http"); const server = http.createServer((req, res) => { let body = ""; req.on("data", (chunk) => { body += chunk; }); req.on("end", () => { const regex = /(.*?)<\/NS1:register>/; console.log(body); const match = body.match(regex); const register = match ? match[1] : null; console.log("register Value:", register); if (req.url === "/TutupRekening" && req.method === "POST") { let xmlInquiryResponse = ''; xmlInquiryResponse = ` false 00 Delete 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(3097, () => { console.log( "SOAP dummy BPJS TK Individual running at http://0.0.0.0:3097/TutupRekening", ); });