From b718200bb71aec04aff452acc2fb80e20ed4da9e Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Sat, 15 Nov 2025 20:42:00 +0000 Subject: [PATCH] completionId: cgen-f81adc27214e431296620d1b38d247d3 cgen-f81adc27214e431296620d1b38d247d3 --- api/blog/index.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/api/blog/index.ts b/api/blog/index.ts index 6761da0b..c0a0880e 100644 --- a/api/blog/index.ts +++ b/api/blog/index.ts @@ -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 { } } -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);