fix:优化启动配置
This commit is contained in:
16
start-api.sh
Normal file
16
start-api.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user