feat: make blog data dynamic

This commit is contained in:
2025-04-12 13:10:38 +05:30
parent ef61d38753
commit 72cd1a7f47
8 changed files with 370 additions and 181 deletions

16
app/api/blogs/route.js Normal file
View File

@@ -0,0 +1,16 @@
import { NextResponse } from "next/server";
import axios from "axios";
import { backendUrl } from "@/utils/axios";
export async function GET() {
try {
const response = await axios.get(`${backendUrl}/blogs/`);
return NextResponse.json(response.data);
} catch (error) {
console.error("Error fetching blogs:", error);
return NextResponse.json(
{ error: "Failed to fetch blog data" },
{ status: 500 }
);
}
}