implemented logging

This commit is contained in:
2026-03-25 11:43:53 +01:00
parent df71ceea7a
commit 2723fb0ca3
4 changed files with 28 additions and 2 deletions

View File

@@ -2,6 +2,7 @@
import Layout from '../layouts/Layout.astro';
const API_URL = (typeof process !== 'undefined' ? process.env.PUBLIC_API_URL : import.meta.env.PUBLIC_API_URL) || 'http://localhost:3000';
console.log('Connecting to backend at:', API_URL);
interface Post {
slug: string;
@@ -18,7 +19,8 @@ try {
error = 'Failed to fetch posts';
}
} catch (e) {
error = 'Could not connect to backend';
error = `Could not connect to backend at ${API_URL}: ${e instanceof Error ? e.message : String(e)}`;
console.error(error);
}
function formatSlug(slug: string) {