Initial commit for Greenlens
This commit is contained in:
19
fetch_plants.js
Normal file
19
fetch_plants.js
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
const { openDatabase, all, closeDatabase, getDefaultDbPath } = require('./server/lib/sqlite');
|
||||
const { getPlants } = require('./server/lib/plants');
|
||||
|
||||
async function main() {
|
||||
let db;
|
||||
try {
|
||||
db = await openDatabase();
|
||||
const plants = await getPlants(db, { limit: 500 });
|
||||
console.log(JSON.stringify(plants, null, 2));
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
} finally {
|
||||
if (db) await closeDatabase(db);
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
Reference in New Issue
Block a user