● Zion Boggan
repos/Zion Pm/app/api/outbox/route.ts
zionboggan.com ↗
15 lines · typescript
History for this file →
1
import { NextRequest, NextResponse } from 'next/server';
2
import { listOutbox, draftOutbox } from '@/lib/db';
3
 
4
export const runtime = 'nodejs';
5
export const dynamic = 'force-dynamic';
6
 
7
export async function GET() {
8
  return NextResponse.json({ outbox: listOutbox() });
9
}
10
 
11
export async function POST(req: NextRequest) {
12
  const { actionType, payload } = await req.json().catch(() => ({}));
13
  const o = draftOutbox(actionType || 'publish', payload || { note: 'stub outward action', created_by: 'conductor' });
14
  return NextResponse.json({ outbox: o });
15
}