Files
hometown/start-api.sh
2026-03-07 23:47:29 +08:00

17 lines
611 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# 仅启动后端 API前后端分离时使用
# 在项目根目录执行: ./start-api.sh 或 PORT=3001 ./start-api.sh
# 若修改了默认端口,前端 api.config.json 的 apiBase 需填完整地址(含端口),如 http://域名或IP:5599
set -e
cd "$(dirname "$0")/server"
PORT="${PORT:-5599}"
export PORT
echo "[720yun-offline-api] 安装依赖..."
npm install --no-audit --no-fund
echo "[720yun-offline-api] 启动 API http://0.0.0.0:${PORT}"
echo "[720yun-offline-api] 前端请将 api.config.json 的 apiBase 设为: http://本机IP或域名:${PORT}"
exec node index.js