Skip to content

Create professional demos and 3D mockups in seconds, directly in your browser

676 B
Raw Blame
import { NextResponse } from "next/server";

export async function GET() {
  try {
    const res = await fetch("https://api.github.com/repos/CristianOlivera1/openvid", {
      headers: {
        "Authorization": `Bearer ${process.env.GITHUB_TOKEN}`,
        "Accept": "application/vnd.github+json"
      },
      next: { revalidate: 3600 } 
    });

    if (!res.ok) {
      throw new Error("Error fetching GitHub API");
    }

    const data = await res.json();
    return NextResponse.json({ stars: data.stargazers_count });
    
  } catch (error) {
    console.error("[GitHub API Route] Error:", error);
    return NextResponse.json({ stars: null }, { status: 500 });
  }
}