Switch to static export with build-time data fetching

- Change from server-side rendering to static export
- Fetch data at build time and save as JSON
- Remove API routes and tests, use static JSON file
- Switch back to WEB platform from WEB_COMPUTE
- Update build test for static export
- Exclude out directory from security scan
- Much simpler and more reliable approach
This commit is contained in:
DaX
2025-06-19 01:13:15 +02:00
parent 2baac7be9f
commit 1a96e5eef6
8 changed files with 43 additions and 67 deletions

View File

@@ -1,39 +0,0 @@
import { NextResponse } from 'next/server';
import { fetchFromConfluence } from '../../../src/server/confluence';
export const runtime = 'nodejs';
export async function GET() {
try {
// Get environment variables from server-side only
const env = {
CONFLUENCE_API_URL: process.env.CONFLUENCE_API_URL,
CONFLUENCE_TOKEN: process.env.CONFLUENCE_TOKEN,
CONFLUENCE_PAGE_ID: process.env.CONFLUENCE_PAGE_ID,
};
// Validate environment variables
if (!env.CONFLUENCE_API_URL || !env.CONFLUENCE_TOKEN || !env.CONFLUENCE_PAGE_ID) {
console.error('Missing Confluence environment variables');
return NextResponse.json(
{ error: 'Server configuration error' },
{ status: 500 }
);
}
const filaments = await fetchFromConfluence(env);
return NextResponse.json(filaments, {
headers: {
'Cache-Control': 'public, s-maxage=300, stale-while-revalidate=600',
},
});
} catch (error) {
console.error('API Error:', error);
// Never expose internal error details to client
return NextResponse.json(
{ error: 'Failed to fetch filaments' },
{ status: 500 }
);
}
}

View File

@@ -34,7 +34,7 @@ export default function Home() {
setLoading(true);
setError(null);
const response = await axios.get('/api/filaments');
const response = await axios.get('/data.json');
setFilaments(response.data);
setLastUpdate(new Date());
} catch (err) {