File size: 1,586 Bytes
f25362a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# dev-start.ps1 — Lance API + UI en mode watch (Kestrel) sans IIS
# Usage : .\dev-start.ps1          (lance les deux)
#         .\dev-start.ps1 -api     (API seulement)
#         .\dev-start.ps1 -ui      (UI seulement)

param(
    [switch]$api,
    [switch]$ui
)

$projetApi = ""
$projetUi  = ""
$urlApi    = "https://localhost:5001"
$urlUi     = "https://localhost:5002"

# Si aucun flag, lancer les deux
if (-not $api -and -not $ui) {
    $api = $true
    $ui  = $true
}

if ($api) {
    if ([string]::IsNullOrWhiteSpace($projetApi)) {
        Write-Host "[ERREUR] Chemin API non configure dans ce depot." -ForegroundColor Red
        exit 1
    }
    Write-Host "[DEV] Demarrage API sur $urlApi ..." -ForegroundColor Cyan
    Start-Process powershell -ArgumentList "-NoExit", "-Command", "cd '$PSScriptRoot'; dotnet watch run --project $projetApi --urls $urlApi"
}

if ($ui) {
    if ([string]::IsNullOrWhiteSpace($projetUi)) {
        Write-Host "[ERREUR] Chemin UI non configure dans ce depot." -ForegroundColor Red
        exit 1
    }
    Write-Host "[DEV] Demarrage UI sur $urlUi ..." -ForegroundColor Green
    Start-Process powershell -ArgumentList "-NoExit", "-Command", "cd '$PSScriptRoot'; dotnet watch run --project $projetUi --urls $urlUi"
}

Write-Host ""
Write-Host "=== Serveurs de developpement ===" -ForegroundColor Yellow
if ($api) { Write-Host "  API     : $urlApi/swagger" -ForegroundColor Cyan }
if ($ui)  { Write-Host "  UI      : $urlUi" -ForegroundColor Green }
Write-Host "  Ctrl+C dans chaque fenetre pour arreter" -ForegroundColor DarkGray
Write-Host ""