11 lines
476 B
TypeScript
11 lines
476 B
TypeScript
import { db } from '@/app/db/drizzle';
|
|
import { domains } from '@/app/db/schema';
|
|
import { authenticate } from '@/app/lib/utils';
|
|
import { NextRequest, NextResponse } from 'next/server';
|
|
|
|
export async function GET(req: NextRequest) {
|
|
if (!authenticate(req)) return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
|
|
|
|
const domainList = await db.select({ bucket: domains.bucket, domain: domains.domain }).from(domains);
|
|
return NextResponse.json(domainList);
|
|
} |