26 lines
647 B
JavaScript
26 lines
647 B
JavaScript
import EleventyFetch from "@11ty/eleventy-fetch";
|
|
|
|
const { POSTGREST_URL, POSTGREST_API_KEY } = process.env;
|
|
|
|
const fetchBlogroll = async () => {
|
|
try {
|
|
return await EleventyFetch(`${POSTGREST_URL}/optimized_blogroll`, {
|
|
duration: "1d",
|
|
type: "json",
|
|
fetchOptions: {
|
|
method: "GET",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
Authorization: `Bearer ${POSTGREST_API_KEY}`,
|
|
},
|
|
},
|
|
});
|
|
} catch (error) {
|
|
console.error("Error fetching and processing the blogroll:", error);
|
|
return [];
|
|
}
|
|
};
|
|
|
|
export default async function () {
|
|
return await fetchBlogroll();
|
|
}
|