mirror of
https://github.com/Redume/Kekkai.git
synced 2025-02-23 20:51:25 +03:00
добавлены регвест на апи ддг по парно к каждой валюте
This commit is contained in:
parent
868be0f39d
commit
e21330bee7
2 changed files with 23 additions and 0 deletions
22
utils/saveCourse.js
Normal file
22
utils/saveCourse.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
const pool = require("../postgresql.js");
|
||||
const yaml = require("yaml")
|
||||
const fs = require("fs");
|
||||
const axios = require("axios");
|
||||
const config = yaml.parse(fs.readFileSync("./config.yaml", "utf-8"));
|
||||
|
||||
async function saveCourse() {
|
||||
for (let i = 0; i < config['currency'].length; i++) {
|
||||
for (let pair in config['currency'] ) {
|
||||
const res = await axios.get(
|
||||
`https://duckduckgo.com/js/spice/currency/1/${config['currency'][i]}/${config['currency'][pair]}`
|
||||
)
|
||||
console.log(res.data)
|
||||
|
||||
//TODO: добавить сохранение в бд
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
module.exports = saveCourse;
|
Loading…
Add table
Reference in a new issue