Initial commit - WhyRating Engine (Google Reviews Scraper)

This commit is contained in:
Alejandro Gutiérrez
2026-02-02 18:19:00 +00:00
parent 0543a08242
commit 2206ddeff2
136 changed files with 51138 additions and 855 deletions

View File

@@ -0,0 +1,42 @@
import { NextRequest, NextResponse } from 'next/server';
const API_BASE_URL = process.env.API_BASE_URL || 'http://localhost:8001';
/**
* Proxy route for ReviewIQ trends endpoint.
* GET /api/pipelines/reviewiq/trends
*/
export async function GET(request: NextRequest) {
try {
// Forward query parameters
const searchParams = request.nextUrl.searchParams;
const queryString = searchParams.toString();
const url = `${API_BASE_URL}/api/pipelines/reviewiq/trends${queryString ? `?${queryString}` : ''}`;
const response = await fetch(url, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
cache: 'no-store',
});
if (!response.ok) {
const errorData = await response.json().catch(() => ({}));
return NextResponse.json(
{ detail: errorData.detail || `Backend error: ${response.status}` },
{ status: response.status }
);
}
const data = await response.json();
return NextResponse.json(data);
} catch (error) {
console.error('ReviewIQ trends proxy error:', error);
return NextResponse.json(
{ detail: 'Failed to fetch trends data' },
{ status: 500 }
);
}
}