45 lines
2.0 KiB
PowerShell
45 lines
2.0 KiB
PowerShell
Write-Host "========================================" -ForegroundColor Cyan
|
|
Write-Host " RESTART BACKEND AND FRONTEND" -ForegroundColor Cyan
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
Write-Host "Step 1: Stopping all Node.js processes..." -ForegroundColor Yellow
|
|
$nodeProcesses = Get-Process node -ErrorAction SilentlyContinue
|
|
if ($nodeProcesses) {
|
|
$nodeProcesses | Stop-Process -Force
|
|
Write-Host "[OK] Stopped $($nodeProcesses.Count) Node.js process(es)" -ForegroundColor Green
|
|
} else {
|
|
Write-Host "[INFO] No Node.js processes running" -ForegroundColor Gray
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "Waiting 3 seconds for ports to be released..." -ForegroundColor Yellow
|
|
Start-Sleep -Seconds 3
|
|
|
|
Write-Host ""
|
|
Write-Host "Step 2: Starting Backend..." -ForegroundColor Yellow
|
|
$backendPath = "C:\Users\LENOVO\Back\the-tip-top-backend"
|
|
Start-Process powershell -ArgumentList "-NoExit", "-Command", "cd '$backendPath'; npm start" -WindowStyle Normal
|
|
Write-Host "[OK] Backend starting..." -ForegroundColor Green
|
|
|
|
Write-Host ""
|
|
Write-Host "Waiting 5 seconds for backend to initialize..." -ForegroundColor Yellow
|
|
Start-Sleep -Seconds 5
|
|
|
|
Write-Host ""
|
|
Write-Host "Step 3: Starting Frontend..." -ForegroundColor Yellow
|
|
$frontendPath = "C:\Users\LENOVO\front\the-tip-top-frontend"
|
|
Start-Process powershell -ArgumentList "-NoExit", "-Command", "cd '$frontendPath'; npm run dev" -WindowStyle Normal
|
|
Write-Host "[OK] Frontend starting..." -ForegroundColor Green
|
|
|
|
Write-Host ""
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|
Write-Host " RESTART COMPLETE" -ForegroundColor Cyan
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
Write-Host "Backend: http://localhost:4000" -ForegroundColor White
|
|
Write-Host "Frontend: http://localhost:3004" -ForegroundColor White
|
|
Write-Host ""
|
|
Write-Host "Press any key to close this window..." -ForegroundColor Gray
|
|
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
|