ThatAIguyA world of ideas

THE CONSCIOUSNESS ATLAS
Read. Experiment. Follow the evidence.

ConsciousnessLearn · Explore · Joseph Anady

Janady13/llms-txt-hub / apps/web/app/api/websites/paginated/route.ts

Source identity, revision, and recovered contents.

GitHub sourceSource text recovered

Source identity

FieldRecorded value
Source typeGitHub source
Original recordJanady13/llms-txt-hub / apps/web/app/api/websites/paginated/route.ts
DateNot specified in source
RepositoryJanady13/llms-txt-hub
Revisione0f4bf978d4df168369c7601d9c5f5ea89e84377
Branchmain
Path or archive memberapps/web/app/api/websites/paginated/route.ts
Original SHA-2564f405eaab6cc54e64549740c0a0cf323a88656ba18fbc262ba2b4490d55ab6d1
Git blob SHAae02fcbd5308b0bdca9a702be75c7fff4ff126e1
Reading-copy SHA-2564f405eaab6cc54e64549740c0a0cf323a88656ba18fbc262ba2b4490d55ab6d1

Original source ↗

Recovered source transcript

import { logger } from '@thedaviddias/logging' import { NextResponse } from 'next/server' import { getWebsites } from '@/lib/content-loader' interface PaginatedWebsitesResponse { websites: Array<{ slug: string name: string description: string website: string category: string publishedAt: string isUnofficial?: boolean }> totalCount: number page: number totalPages: number hasMore: boolean } /** * API endpoint for paginated website loading * Used for Load More pattern - loads 48 websites at a time by default */ export async function GET(request: Request) { try { const { searchParams } = new URL(request.url) const page = Math.max(1, Number.parseInt(searchParams.get('page') || '1', 10)) const limit = Math.min( 100, Math.max(10, Number.parseInt(searchParams.get('limit') || '48', 10)) ) const offset = Number.parseInt(searchParams.get('offset') || '0', 10) const allWebsites = await getWebsites() const totalCount = allWebsites.length // Calculate pagination const startIndex = offset || (page - 1) * limit const endIndex = startIndex + limit const websites = allWebsites.slice(startIndex, endIndex) const totalPages = Math.ceil(totalCount / limit) const hasMore = endIndex < totalCount const response: PaginatedWebsitesResponse = { websites: websites.map(website => ({ slug: website.slug, name: website.name, description: website.description, website: website.website, category: website.category, publishedAt: website.publishedAt, isUnofficial: website.isUnofficial })), totalCount, page, totalPages, hasMore } return NextResponse.json(response) } catch (error) { logger.error('Error fetching paginated websites', { data: error, tags: { api: 'websites-paginated' } }) return NextResponse.json({ error: 'Failed to fetch websites' }, { status: 500 }) } }

Search equations, builds, manuscript text, and recovered sources.