GET SINGLE
Fetch a single sensor
GET /api/sensors/:id
// TypeScript
// src/app/api/sensors/[id]/route.ts
export async function GET(req: Request, { params }: { params: { id: string } }) {
const supabase = createClient();
const { data, error } = await supabase.from("sensors").select("*").eq("id", params.id).single();
if (error) return NextResponse.json({ error: error.message }, { status: 404 });
return NextResponse.json(data, { status: 200 });
}
Last updated