Cook up systems ingest script for pocketbase
This commit is contained in:
26
ingest/systems.js
Normal file
26
ingest/systems.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import fs from 'fs';
|
||||
|
||||
const data = JSON.parse(fs.readFileSync('systems.json', 'utf8'));
|
||||
const pbUrl = "https://evebase.site.quack-lab.dev/api/collections/system/records"
|
||||
|
||||
async function main() {
|
||||
for (const system of data) {
|
||||
const datum = {
|
||||
name: system.solarSystemName,
|
||||
region: system.regionName,
|
||||
connectedTo: system.connectedSystems,
|
||||
}
|
||||
const headers = {
|
||||
'Content-Type': 'application/json',
|
||||
}
|
||||
const response = await fetch(pbUrl, {
|
||||
method: 'POST',
|
||||
headers: headers,
|
||||
body: JSON.stringify(datum),
|
||||
});
|
||||
console.log(response);
|
||||
}
|
||||
}
|
||||
main().then(() => {
|
||||
console.log('done');
|
||||
});
|
||||
Reference in New Issue
Block a user