first version
This commit is contained in:
11
app/api/domains/route.ts
Normal file
11
app/api/domains/route.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user