63 lines
2.5 KiB
PowerShell
63 lines
2.5 KiB
PowerShell
# Twilio 视频通话服务启动脚本
|
||
# 使用方法: .\start-services.ps1
|
||
|
||
Write-Host "🚀 启动 Twilio 视频通话服务..." -ForegroundColor Green
|
||
Write-Host ""
|
||
|
||
# 检查 Node.js 是否安装
|
||
if (-not (Get-Command node -ErrorAction SilentlyContinue)) {
|
||
Write-Host "❌ 错误: 未找到 Node.js,请先安装 Node.js" -ForegroundColor Red
|
||
exit 1
|
||
}
|
||
|
||
# 检查 npm 是否安装
|
||
if (-not (Get-Command npm -ErrorAction SilentlyContinue)) {
|
||
Write-Host "❌ 错误: 未找到 npm,请先安装 npm" -ForegroundColor Red
|
||
exit 1
|
||
}
|
||
|
||
Write-Host "✅ Node.js 和 npm 已安装" -ForegroundColor Green
|
||
|
||
# 启动后端服务器
|
||
Write-Host ""
|
||
Write-Host "🔧 启动后端 Token 服务器..." -ForegroundColor Yellow
|
||
Write-Host "端口: 3001" -ForegroundColor Cyan
|
||
|
||
Start-Process powershell -ArgumentList "-NoExit", "-Command", "cd server; npm install; npm start" -WindowStyle Normal
|
||
|
||
# 等待后端服务器启动
|
||
Write-Host "⏳ 等待后端服务器启动..." -ForegroundColor Yellow
|
||
Start-Sleep -Seconds 3
|
||
|
||
# 启动前端应用
|
||
Write-Host ""
|
||
Write-Host "🔧 启动前端应用..." -ForegroundColor Yellow
|
||
Write-Host "端口: 5173" -ForegroundColor Cyan
|
||
|
||
Start-Process powershell -ArgumentList "-NoExit", "-Command", "npm install; npm run dev" -WindowStyle Normal
|
||
|
||
# 等待前端应用启动
|
||
Write-Host "⏳ 等待前端应用启动..." -ForegroundColor Yellow
|
||
Start-Sleep -Seconds 5
|
||
|
||
Write-Host ""
|
||
Write-Host "🎉 服务启动完成!" -ForegroundColor Green
|
||
Write-Host ""
|
||
Write-Host "📋 访问地址:" -ForegroundColor Cyan
|
||
Write-Host " • 前端应用: http://localhost:5173" -ForegroundColor White
|
||
Write-Host " • 后端 API: http://localhost:3001" -ForegroundColor White
|
||
Write-Host " • 健康检查: http://localhost:3001/health" -ForegroundColor White
|
||
Write-Host ""
|
||
Write-Host "🧪 测试页面:" -ForegroundColor Cyan
|
||
Write-Host " • 设备测试: http://localhost:5173/device-test" -ForegroundColor White
|
||
Write-Host " • 视频通话: http://localhost:5173/video-call" -ForegroundColor White
|
||
Write-Host ""
|
||
Write-Host "⚠️ 注意事项:" -ForegroundColor Yellow
|
||
Write-Host " 1. 确保已配置正确的 Twilio 凭证" -ForegroundColor White
|
||
Write-Host " 2. 浏览器需要允许摄像头和麦克风权限" -ForegroundColor White
|
||
Write-Host " 3. 建议使用 Chrome 浏览器进行测试" -ForegroundColor White
|
||
Write-Host ""
|
||
Write-Host "📖 详细测试指南请查看: TWILIO_TEST_GUIDE.md" -ForegroundColor Cyan
|
||
Write-Host ""
|
||
Write-Host "按任意键退出..." -ForegroundColor Gray
|
||
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") |