Initial commit
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
import { requireAuth } from '@/lib/auth'
|
||||
import { getAnalyticsStats, getAllDomains } from '@/lib/appDb'
|
||||
|
||||
export async function GET(req: NextRequest) {
|
||||
const err = await requireAuth(req)
|
||||
if (err) return err
|
||||
|
||||
const domain = req.nextUrl.searchParams.get('domain')
|
||||
const days = parseInt(req.nextUrl.searchParams.get('days') ?? '30')
|
||||
|
||||
if (!domain) {
|
||||
// Domain listesi döndür
|
||||
const domains = await getAllDomains()
|
||||
return NextResponse.json({ domains })
|
||||
}
|
||||
|
||||
const stats = await getAnalyticsStats(domain, days)
|
||||
return NextResponse.json(stats)
|
||||
}
|
||||
Reference in New Issue
Block a user