"use strict";
exports.__esModule = true;
var request = require("request");
var url = 'https://api.exchangeratesapi.io/latest';
var result = '';
request.get(url)
    .on('response', function (res) {
    console.log("statusCode = " + res.statusCode);
})
    .on('data', function (data) {
    console.log('ได้ข้อมูล');
    result += data;
})
    .on('end', function (res) {
    //console.log(`พร้อมทำงาน เอา data ไปทำอะไรดี`);  
    var exchange = JSON.parse(result);
    //console.log(exchange);
    var r = exchange.rates;
    var money = 1000;
    console.log("\u0E40\u0E07\u0E34\u0E19 " + money + " \u0E1A\u0E32\u0E17 = " + money * r.USD / r.THB + " USD");
});
