Engineering manualAPI route source
/api/brands/review-watch
Exact current route handler: hosted-app/app/api/brands/review-watch/route.js
Methods: GET, POST. Input signals: query parameters. Literal response-status signals: none detected.
Source: hosted-app/app/api/brands/review-watch/route.js. Imports: ../../../../lib/bounded-http.mjs, ../../../../lib/comprehensive-pull.mjs, ../../../../lib/review-watches.mjs, ../../../../lib/supabase-rest.mjs, next/server. Exact source is shown for inspection; its presence does not prove authentication, validation or live behavior.
All API routes · API and execution contract
import { NextResponse } from "next/server";
import { supabaseConfigFromEnv } from "../../../../lib/supabase-rest.mjs";
import { bearerTokenFromHeader } from "../../../../lib/comprehensive-pull.mjs";
import { readBoundedJsonRequest } from "../../../../lib/bounded-http.mjs";
import { getReviewWatches, setReviewWatch } from "../../../../lib/review-watches.mjs";
export const runtime = "nodejs";
export const dynamic = "force-dynamic";
export const maxDuration = 30;
const PRIVATE = { "cache-control": "private, no-store", "x-content-type-options": "nosniff" };
const reply = (result) => NextResponse.json(result.body, { status: result.http_status, headers: PRIVATE });
const tokenOf = (request) => bearerTokenFromHeader(request.headers.get("authorization"));
export async function GET(request) {
const domain = new URL(request.url).searchParams.get("domain") || "";
return reply(await getReviewWatches({ token: tokenOf(request), config: supabaseConfigFromEnv(process.env), domain }));
}
export async function POST(request) {
let body;
try { body = await readBoundedJsonRequest(request, 16384); }
catch (error) { return NextResponse.json({ status: "refused", reason: error.message }, { status: error.httpStatus || 400, headers: PRIVATE }); }
return reply(await setReviewWatch({ token: tokenOf(request), config: supabaseConfigFromEnv(process.env), body: body || {} }));
}