La inn script for start og stopp av MinAttest i development.
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
# Start MinAttest Development Environment (Windows)
|
||||
|
||||
Write-Host "🚀 Starting MinAttest Development Environment..." -ForegroundColor Cyan
|
||||
|
||||
# Function to check if a port is in use
|
||||
function Test-PortInUse {
|
||||
param (
|
||||
[int]$Port
|
||||
)
|
||||
$tcpConnection = Get-NetTCPConnection -LocalPort $Port -ErrorAction SilentlyContinue
|
||||
return $tcpConnection -ne $null
|
||||
}
|
||||
|
||||
# 1. Start Backend (Aspire AppHost) - Port 7172
|
||||
if (Test-PortInUse -Port 7172) {
|
||||
Write-Host "✅ Backend (API) is already running on port 7172." -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "🚀 Starting Backend (Aspire AppHost)..." -ForegroundColor Yellow
|
||||
Start-Process -FilePath "dotnet" -ArgumentList "run --project backend/MinAttest.AppHost/MinAttest.AppHost.csproj" -NoNewWindow
|
||||
|
||||
# Wait loop (simple pause as checking port immediately might be flaky during startup)
|
||||
Start-Sleep -Seconds 5
|
||||
}
|
||||
|
||||
# 2. Start BFF (Reverse Proxy) - Port 10001
|
||||
if (Test-PortInUse -Port 10001) {
|
||||
Write-Host "✅ BFF is already running on port 10001." -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "🚀 Starting BFF..." -ForegroundColor Yellow
|
||||
Start-Process -FilePath "dotnet" -ArgumentList "run --project frontend/minattest-app-host/minattest-app-host.csproj" -NoNewWindow
|
||||
Start-Sleep -Seconds 2
|
||||
}
|
||||
|
||||
# 3. Start Frontend (Vite) - Port 5173
|
||||
if (Test-PortInUse -Port 5173) {
|
||||
Write-Host "✅ Frontend is already running on port 5173." -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "🚀 Starting Frontend..." -ForegroundColor Yellow
|
||||
Set-Location "frontend/minattest-app"
|
||||
|
||||
if (-not (Test-Path "node_modules")) {
|
||||
Write-Host "📦 Installing dependencies..." -ForegroundColor Yellow
|
||||
Start-Process -FilePath "npm" -ArgumentList "install" -NoNewWindow -Wait
|
||||
}
|
||||
|
||||
Start-Process -FilePath "npm" -ArgumentList "run dev" -NoNewWindow
|
||||
Set-Location "../.."
|
||||
}
|
||||
|
||||
Write-Host "✨ All services are starting up!" -ForegroundColor Cyan
|
||||
Write-Host " - Backend API: https://localhost:7172"
|
||||
Write-Host " - BFF: https://localhost:10001"
|
||||
Write-Host " - Frontend: http://localhost:5173"
|
||||
Reference in New Issue
Block a user