import express from "express"; import colors from "colors"; import axios from "axios"; import util from "util" // colors colors.enable(); // express app const app = express(); const port = process.env.NODEJS_PORT || 3001; app.listen(port, () => { console.log(`Express app running on Port: ${port}`.green); }); // data const url = "https://www3.bcb.gov.br/wssgs/services/FachadaWSSGS?method=getValor"; const headers = { headers: { "user-agent": "AIR-nodejs", "Content-Type": "text/xml;charset=UTF-8", soapAction: "https://www3.bcb.gov.br/wssgs/services/FachadaWSSGS/getValor", }, }; const xml = `\ 4392 18/06/2020 `; // express routes const routes = express.Router(); app.use("/", routes); // routes controller routes.route("").get((request, response) => { axios .post(url, xml, headers) .then((response) => { console.log(`${util.inspect(response.data, false, null)}`.yellow); }) .catch((error) => { console.log(error); }); response.send("done"); });