Spaces:
Running

hub / run-dev.js
Andre
deploy: snapshot c96b9ab -- Inventory Journals (Lagerforandringsjournal) na Contabilidade (v1.3.61)
77db408
Raw History Blame Contribute Delete
963 Bytes
const { spawn } = require('child_process');
const path = require('path');
const isWindows = process.platform === 'win32';
const backendDir = path.join(__dirname, 'backend');
const frontendDir = path.join(__dirname, 'frontend');
const backend = spawn(
isWindows ? '.venv\\Scripts\\python.exe' : 'python',
isWindows ? ['-m', 'uvicorn', 'main:app', '--reload'] : ['-m', 'uvicorn', 'main:app', '--reload'],
{
cwd: backendDir,
shell: true,
stdio: 'inherit'
}
);
const frontend = spawn(isWindows ? 'npm.cmd' : 'npm', ['run', 'dev'], {
cwd: frontendDir,
shell: true,
stdio: 'inherit'
});
console.log('\n--- Backend (FastAPI) running at http://127.0.0.1:8000 ---\n');
console.log('--- Frontend (Next.js) running at http://localhost:3000 ---\n');
const cleanup = () => {
console.log('\n\nShutting down servers...');
backend.kill();
frontend.kill();
process.exit(0);
};
process.on('SIGINT', cleanup);
process.on('SIGTERM', cleanup);