Commit all scripts
This commit is contained in:
16
colaflow-api/wait-for-api.ps1
Normal file
16
colaflow-api/wait-for-api.ps1
Normal file
@@ -0,0 +1,16 @@
|
||||
Write-Host "Waiting for API to start..." -ForegroundColor Yellow
|
||||
|
||||
for ($i = 1; $i -le 30; $i++) {
|
||||
Start-Sleep -Seconds 2
|
||||
try {
|
||||
$response = Invoke-WebRequest -Uri 'http://localhost:5167/api/auth/me' `
|
||||
-Method Get -SkipHttpErrorCheck -UseBasicParsing -TimeoutSec 2 -ErrorAction Stop
|
||||
Write-Host "API is ready! (Status: $($response.StatusCode))" -ForegroundColor Green
|
||||
exit 0
|
||||
} catch {
|
||||
Write-Host "Attempt $i/30..." -ForegroundColor Gray
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "API failed to start after 60 seconds" -ForegroundColor Red
|
||||
exit 1
|
||||
Reference in New Issue
Block a user