feat: Switch to Astro SSR with API routes support

- Changed output: 'static' → 'server' in astro.config.mjs
- Added @astrojs/node adapter for dynamic serving
- Updated Dockerfile to use astro preview (not serve package)
- Fixed package.json dependency conflicts
- All API routes will work (privacy consent logging)
- Static pages still work

Now includes BOTH:
-  Static pages (product pages, blog)
-  Dynamic API routes (cookie consent logging)
-  Admin dashboard with database access
-  Fixed host restrictions
This commit is contained in:
Kunthawat
2026-03-12 13:43:58 +07:00
parent 74d7e5bee8
commit af32f9a962
19 changed files with 49 additions and 33 deletions

View File

@@ -1,13 +1,22 @@
// @ts-check
import { defineConfig } from 'astro/config';
import tailwindcss from '@tailwindcss/vite';
// https://astro.build/config
// For SSR with API routes
import node from '@astrojs/node';
export default defineConfig({
output: 'static', // Changed from 'hybrid' (deprecated)
output: 'server',
adapter: node({ mode: 'standalone' }),
build: {
inlineStylesheets: 'always',
},
// Remove vite config - we only serve static files via serve package
// No preview/server config needed since using static file serving
});
vite: {
preview: {
host: true, // Allow any host
port: 80,
},
server: {
host: true, // Allow any host
port: 80,
},
},
});