
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();
