import { NextResponse } from "next/server"; import { authenticateRequest, handleApiError } from "@/lib/api/authenticate"; import { listPlants } from "@/lib/services/plants"; // GET /api/v1/plants?q=apple export async function GET(req: Request) { try { const ctx = await authenticateRequest(req, "plants:read"); const q = new URL(req.url).searchParams.get("q") ?? undefined; return NextResponse.json(await listPlants(ctx, { q })); } catch (err) { return handleApiError(err); } }