D1Database is undefined, why? i followed the tutorial
D1Database is undefined, why? i followed the tutorial
wrangler.toml file
all() returns a D1Result objectconst { results } = await stmt.all(); to grab just the results propertyconst { results } = await stmt.all();results will be an empty array if there were no results, or null if it doesn't apply (that query doesn't return anything).
npx wrangler d1 execute or npx wrangler d1 migrations apply not authorized to use function: strftimename = "foxes"
main = "src/index.js"
compatibility_date = "2023-05-18"
[[d1_databases]]
binding = "DB"
database_name = "foxes"
database_id = "im-not-sure-if-its-safe-to-share-it"const results = await stmt.all();
if (results.length > 0) {nullnpx wrangler d1 executenpx wrangler d1 migrations applynot authorized to use function: strftimeconst { results } = await stmt.all();
if (results && results.length > 0) {