a new start
This commit is contained in:
24
app/api/stats/route.ts
Normal file
24
app/api/stats/route.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { NextResponse } from 'next/server'
|
||||
import { getStats, getLanguages, getCategories, getTrendingRepositories } from '@/lib/db'
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
const stats = getStats()
|
||||
const languages = getLanguages()
|
||||
const categories = getCategories()
|
||||
const trending = getTrendingRepositories(10)
|
||||
|
||||
return NextResponse.json({
|
||||
stats,
|
||||
languages,
|
||||
categories,
|
||||
trending
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('Stats API error:', error)
|
||||
return NextResponse.json(
|
||||
{ error: 'Internal server error' },
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user