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

@@ -15,6 +15,9 @@
"marked": "^17.0.5", "marked": "^17.0.5",
"tailwindcss": "^4.2.2" "tailwindcss": "^4.2.2"
}, },
"devDependencies": {
"@types/node": "^25.5.0"
},
"engines": { "engines": {
"node": ">=22.12.0" "node": ">=22.12.0"
} }
@@ -1986,6 +1989,16 @@
"@types/unist": "*" "@types/unist": "*"
} }
}, },
"node_modules/@types/node": {
"version": "25.5.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.5.0.tgz",
"integrity": "sha512-jp2P3tQMSxWugkCUKLRPVUpGaL5MVFwF8RDuSRztfwgN1wmqJeMSbKlnEtQqU8UrhTmzEmZdu2I6v2dpp7XIxw==",
"devOptional": true,
"license": "MIT",
"dependencies": {
"undici-types": "~7.18.0"
}
},
"node_modules/@types/unist": { "node_modules/@types/unist": {
"version": "3.0.3", "version": "3.0.3",
"resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz",
@@ -5160,6 +5173,13 @@
"integrity": "sha512-Ql87qFHB3s/De2ClA9e0gsnS6zXG27SkTiSJwjCc9MebbfapQfuPzumMIUMi38ezPZVNFcHI9sUIepeQfw8J8Q==", "integrity": "sha512-Ql87qFHB3s/De2ClA9e0gsnS6zXG27SkTiSJwjCc9MebbfapQfuPzumMIUMi38ezPZVNFcHI9sUIepeQfw8J8Q==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/undici-types": {
"version": "7.18.2",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.18.2.tgz",
"integrity": "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==",
"devOptional": true,
"license": "MIT"
},
"node_modules/unified": { "node_modules/unified": {
"version": "11.0.5", "version": "11.0.5",
"resolved": "https://registry.npmjs.org/unified/-/unified-11.0.5.tgz", "resolved": "https://registry.npmjs.org/unified/-/unified-11.0.5.tgz",

View File

@@ -18,5 +18,8 @@
"astro": "^6.0.8", "astro": "^6.0.8",
"marked": "^17.0.5", "marked": "^17.0.5",
"tailwindcss": "^4.2.2" "tailwindcss": "^4.2.2"
},
"devDependencies": {
"@types/node": "^25.5.0"
} }
} }

View File

@@ -2,6 +2,7 @@
import Layout from '../layouts/Layout.astro'; 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'; 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 { interface Post {
slug: string; slug: string;
@@ -18,7 +19,8 @@ try {
error = 'Failed to fetch posts'; error = 'Failed to fetch posts';
} }
} catch (e) { } 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) { function formatSlug(slug: string) {

View File

@@ -25,7 +25,8 @@ try {
error = 'Post not found'; error = 'Post not found';
} }
} catch (e) { } 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) { function formatSlug(slug: string) {