Initial commit

This commit is contained in:
2025-04-21 14:12:36 +02:00
commit 3fe2969b39
57 changed files with 17976 additions and 0 deletions

44
production.js Normal file
View File

@@ -0,0 +1,44 @@
import { spawn } from 'child_process';
import { dirname } from 'path';
import { fileURLToPath } from 'url';
const __dirname = dirname(fileURLToPath(import.meta.url));
// Start the WebSocket server
console.log('Starting WebSocket server');
const wsServer = spawn('node', ['src/websocket-server.js'], {
stdio: 'inherit',
shell: true,
cwd: __dirname
});
// Start the SvelteKit production server
console.log('Starting SvelteKit production server');
const sveltekit = spawn('node', ['build/index.js'], {
stdio: 'inherit',
shell: true,
cwd: __dirname
});
// Handle process exit
process.on('exit', () => {
console.log('Shutting down servers...');
wsServer.kill();
sveltekit.kill();
});
// Handle ctrl+c
process.on('SIGINT', () => {
console.log('Received SIGINT, shutting down servers...');
wsServer.kill('SIGINT');
sveltekit.kill('SIGINT');
process.exit(0);
});
// Handle termination
process.on('SIGTERM', () => {
console.log('Received SIGTERM, shutting down servers...');
wsServer.kill('SIGTERM');
sveltekit.kill('SIGTERM');
process.exit(0);
});