Posts engine (SQLite + auto-publisher via poller), public feed with clickable tags, reader, admin panel, submit/search/queue tools. BFF proxy to pipeline API. Clean dark design. Docker-ready.
15 lines
475 B
TypeScript
15 lines
475 B
TypeScript
import { NextRequest } from "next/server"
|
|
import { publishPost } from "@/lib/db"
|
|
|
|
export async function POST(
|
|
req: NextRequest,
|
|
{ params }: { params: Promise<{ id: string }> },
|
|
) {
|
|
const { id } = await params
|
|
const body = await req.json().catch(() => ({}))
|
|
const publish = body.publish !== false
|
|
const post = publishPost(Number(id), publish)
|
|
if (!post) return Response.json({ error: "Post not found" }, { status: 404 })
|
|
return Response.json({ data: post })
|
|
}
|