npm install currency-converter-lt
import CurrencyConverter from 'currency-converter-lt';
async function getExchangeRate() {
let currencyConverter = new CurrencyConverter({ from: "USD", to: "KRW" });
try {
const rate = await currencyConverter.convert();
console.log(`현재 원-달러 환율: ${rate}`);
} catch (error) {
console.error("환율을 불러오는 도중 오류가 발생했습니다:", error);
}
}
getExchangeRate();