| | const { spawn } = require('child_process'); |
| | const path = require('path'); |
| |
|
| | console.log('π Starting Lin Development Environment...'); |
| | console.log('==========================================\n'); |
| |
|
| | |
| | console.log('π§ Starting Backend Server...'); |
| | const backend = spawn('python', ['app.py'], { |
| | cwd: path.join(__dirname, 'backend'), |
| | stdio: 'inherit', |
| | shell: true |
| | }); |
| |
|
| | |
| | console.log('π¨ Starting Frontend Development Server...'); |
| | const frontend = spawn('npm', ['run', 'dev'], { |
| | cwd: path.join(__dirname, 'frontend'), |
| | stdio: 'inherit', |
| | shell: true |
| | }); |
| |
|
| | |
| | backend.on('close', (code) => { |
| | console.log(`Backend process exited with code ${code}`); |
| | frontend.kill(); |
| | }); |
| |
|
| | frontend.on('close', (code) => { |
| | console.log(`Frontend process exited with code ${code}`); |
| | backend.kill(); |
| | }); |
| |
|
| | |
| | process.on('SIGINT', () => { |
| | console.log('\nπ Shutting down development servers...'); |
| | backend.kill(); |
| | frontend.kill(); |
| | process.exit(0); |
| | }); |
| |
|
| | process.on('SIGTERM', () => { |
| | console.log('\nπ Shutting down development servers...'); |
| | backend.kill(); |
| | frontend.kill(); |
| | process.exit(0); |
| | }); |