Files
backend/run.sh
lan 4b4980820f
Some checks failed
SonarQube Analysis / sonarqube (push) Has been cancelled
Test / test (push) Has been cancelled
Test / lint (push) Has been cancelled
Test / build (push) Has been cancelled
chore: 初始化仓库,排除二进制文件和覆盖率文件
2025-11-28 23:30:49 +08:00

37 lines
1.0 KiB
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.

#!/bin/bash
echo "================================"
echo " CarrotSkin Backend Server"
echo "================================"
echo ""
echo "[1/3] 检查swag工具..."
if ! command -v swag &> /dev/null; then
echo "[警告] swag工具未安装正在安装..."
go install github.com/swaggo/swag/cmd/swag@latest
if [ $? -ne 0 ]; then
echo "[错误] swag安装失败请手动安装: go install github.com/swaggo/swag/cmd/swag@latest"
exit 1
fi
echo "[成功] swag工具安装完成"
else
echo "[成功] swag工具已安装"
fi
echo ""
echo "[2/3] 生成Swagger API文档..."
swag init -g cmd/server/main.go -o docs --parseDependency --parseInternal
if [ $? -ne 0 ]; then
echo "[错误] Swagger文档生成失败"
exit 1
fi
echo "[成功] Swagger文档生成完成"
echo ""
echo "[3/3] 启动服务器..."
echo "服务地址: http://localhost:8080"
echo "Swagger文档: http://localhost:8080/swagger/index.html"
echo "按 Ctrl+C 停止服务"
echo ""
go run cmd/server/main.go