feature/improved data gathering from API
This commit is contained in:
1 parent
a173b8c70c
commit
5bbfde3127
3 files changed
+12
-7
No files matched your search
@@ -1,7 +1,6 @@
|
|||||||
function convert(from) {
|
async function convert(from) {
|
||||||
fetch(`https://api.frankfurter.dev/v1/latest?base=${from}`)
|
const res = await fetch(`https://api.frankfurter.dev/v1/latest?base=${from}`);
|
||||||
.then((resp) => resp.json())
|
const data = await res.json();
|
||||||
.then((data) => {
|
|
||||||
console.log(data);
|
return data;
|
||||||
});
|
|
||||||
}
|
}
|
||||||
@@ -40,4 +40,4 @@ function error(err) {
|
|||||||
console.error("Geolocation error: ", err);
|
console.error("Geolocation error: ", err);
|
||||||
}
|
}
|
||||||
|
|
||||||
getLocation();
|
//getLocation();
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
const { getCollection } = require('./src/database/connection');
|
||||||
|
|
||||||
|
async function saveExchangeRates() {
|
||||||
|
const { currencies } = getCollection();
|
||||||
|
await currencies.insertMany(convert());
|
||||||
|
}
|
||||||
Reference in new issue
Block a user