Adjust posts list

This commit is contained in:
Fred Boniface 2023-10-06 11:17:27 +01:00
parent c3ec9acbdd
commit 2e3f88dd0a
1 changed files with 1 additions and 1 deletions

View File

@ -8,7 +8,7 @@ const length = 8; // Number of posts to return
export async function GET({ url }) { export async function GET({ url }) {
const db = await mongoConnect(); const db = await mongoConnect();
const col = db.db('fredboniface').collection('posts'); const col = db.db('fredboniface').collection('posts');
const res = await col.find().sort({ _id: -1 }).limit(2).toArray(); const res = await col.find().sort({ _id: -1 }).limit(length).toArray();
return json(res); return json(res);
} }