chat/frontend/start.sh

30 lines
754 B
Bash
Executable File
Raw Permalink 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.

#!/bin/bash
# 簡單的 HTTP 服務器啟動腳本
PORT=${1:-3000}
echo "正在啟動前端服務器..."
echo "訪問地址: http://localhost:${PORT}"
echo ""
echo "按 Ctrl+C 停止服務器"
echo ""
# 檢查是否有 Python
if command -v python3 &> /dev/null; then
echo "使用 Python HTTP 服務器"
python3 -m http.server $PORT
elif command -v python &> /dev/null; then
echo "使用 Python HTTP 服務器"
python -m http.server $PORT
# 檢查是否有 Node.js 和 http-server
elif command -v npx &> /dev/null; then
echo "使用 Node.js http-server"
npx http-server -p $PORT -c-1
else
echo "錯誤: 未找到 Python 或 Node.js"
echo "請安裝 Python 3 或 Node.js或使用其他 HTTP 服務器"
exit 1
fi