import { NextRequest, NextResponse } from "next/server"; import { getBackend } from "@/lib/backend"; export const dynamic = "force-dynamic"; export async function GET() { return NextResponse.json({ channels: await getBackend().listChannels() }); } // POST /api/bff/channels — create a channel or DM export async function POST(req: NextRequest) { const body = await req.json().catch(() => ({})); const channel = await getBackend().createChannel({ name: String(body.name ?? "new-channel"), kind: body.kind, topic: body.topic, memberIds: body.memberIds, }); return NextResponse.json({ channel }, { status: 201 }); }