completionId: cgen-f81adc27214e431296620d1b38d247d3
cgen-f81adc27214e431296620d1b38d247d3
This commit is contained in:
parent
5f9425954b
commit
b718200bb7
1 changed files with 5 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue