- Enhanced server startup message to include dynamic protocol and domain based on the environment (production or development). - Updated translation references from GitHub to Gitea across multiple languages for consistency. - Refactored layout and metadata in Astro components to utilize SITE configuration for URLs, ensuring accurate site links. - Cleaned up unused code in the layout file and removed commented-out sections for better readability.
29 lines
957 B
JavaScript
29 lines
957 B
JavaScript
import express from 'express';
|
|
import compression from 'compression';
|
|
import { handler } from './dist/server/entry.mjs';
|
|
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
const app = express();
|
|
const PORT = process.env.PORT || 3000;
|
|
|
|
// Enable gzip/brotli compression
|
|
app.use(compression());
|
|
|
|
// Serve static assets from the dist/client directory
|
|
app.use(express.static(path.join(__dirname, 'dist/client')));
|
|
|
|
// Handle all SSR requests with Astro's handler
|
|
app.all('*', handler);
|
|
|
|
app.listen(PORT, () => {
|
|
const isProduction = process.env.NODE_ENV === 'production';
|
|
const domain = isProduction ? '365devnet.eu' : `localhost:${PORT}`;
|
|
const protocol = isProduction ? 'https' : 'http';
|
|
|
|
console.log(`Server running with compression on ${protocol}://${domain}`);
|
|
if (!isProduction) {
|
|
console.log(`Development server accessible at http://localhost:${PORT}`);
|
|
}
|
|
});
|