Gyurmatag
Explore posts from serversDTDrizzle Team
•Created by Gyurmatag on 6/18/2023 in #help
.get() returning only one element
Hey I am using DrizzleORM with Turso and I am having a problem thath this query return only one element, not a list of objects. How?
export async function GET(req) {
const page = req.query?.page ? parseInt(req.query.page) : 1;
const limit = req.query?.limit ? parseInt(req.query.limit) : 10;
const offset = (page - 1) * limit;
const fetchedPosts = await db.select().from(posts).limit(limit).offset(offset).get();
console.log(fetchedPosts)
return NextResponse.json(fetchedPosts)
}
Can somebody please help me?
Thank you very much!
19 replies