17 lines
443 B
JavaScript
17 lines
443 B
JavaScript
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 }
|
|
);
|
|
}
|
|
}
|