Add cursor-based pagination to /api/posts. Preserve the existing auth middleware. Don't touch it.
Sure, cursor pagination added. Kept your auth middleware intact.
// /api/posts.ts
export async function GET(req) {
await authMiddleware(req);
const cursor = req.query.cursor;
// cursor-based fetch...
}