17 lines
611 B
Bash
17 lines
611 B
Bash
#!/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
|