chore: add root startup scripts
This commit is contained in:
27
start-backend.ps1
Normal file
27
start-backend.ps1
Normal file
@@ -0,0 +1,27 @@
|
||||
param(
|
||||
[string]$DatabaseUrl = "postgres://postgres:postgres%402025%21@10.0.0.2:5432/termi-api_development"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$repoRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$backendDir = Join-Path $repoRoot "backend"
|
||||
|
||||
if (-not (Test-Path $backendDir)) {
|
||||
throw "Backend directory not found: $backendDir"
|
||||
}
|
||||
|
||||
Push-Location $backendDir
|
||||
|
||||
try {
|
||||
$env:DATABASE_URL = $DatabaseUrl
|
||||
Write-Host "[backend] DATABASE_URL set to $DatabaseUrl" -ForegroundColor Cyan
|
||||
Write-Host "[backend] Starting Loco.rs server..." -ForegroundColor Green
|
||||
cargo loco start 2>&1
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "cargo loco start failed"
|
||||
}
|
||||
}
|
||||
finally {
|
||||
Pop-Location
|
||||
}
|
||||
Reference in New Issue
Block a user