completionId: cgen-f81adc27214e431296620d1b38d247d3

cgen-f81adc27214e431296620d1b38d247d3
This commit is contained in:
Builder.io 2025-11-15 20:42:00 +00:00
parent 5f9425954b
commit b718200bb7

View file

@ -1,4 +1,5 @@
import { createClient } from "@supabase/supabase-js";
import type { VercelRequest, VercelResponse } from "@vercel/node";
const supabaseUrl = process.env.SUPABASE_URL || "";
const supabaseServiceRole = process.env.SUPABASE_SERVICE_ROLE || "";
@ -115,13 +116,15 @@ async function fetchFromSupabase(limit: number = 50): Promise<any[]> {
}
}
export default async function handler(req: any, res: any) {
export default async function handler(req: VercelRequest, res: VercelResponse) {
res.setHeader("Content-Type", "application/json");
if (req.method !== "GET") {
return res.status(405).json({ error: "Method not allowed" });
}
try {
const limit = Math.min(parseInt(req.query.limit as string) || 50, 100);
const limit = Math.min(parseInt((req.query.limit as string) || "50"), 100);
// Try Ghost first, then Supabase
let posts = await fetchFromGhost(limit);