45 lines
886 B
Bash
45 lines
886 B
Bash
#!/bin/bash
|
|
|
|
echo "🗺️ XML Sitemap Generator API"
|
|
echo "=============================="
|
|
echo ""
|
|
|
|
# Check if Go is installed
|
|
if ! command -v go &> /dev/null; then
|
|
echo "❌ Error: Go is not installed"
|
|
echo "Please install Go 1.21+ from https://golang.org/dl/"
|
|
exit 1
|
|
fi
|
|
|
|
echo "✅ Go version: $(go version)"
|
|
echo ""
|
|
|
|
# Install dependencies
|
|
echo "📦 Installing dependencies..."
|
|
go mod download
|
|
if [ $? -ne 0 ]; then
|
|
echo "❌ Failed to download dependencies"
|
|
exit 1
|
|
fi
|
|
echo "✅ Dependencies installed"
|
|
echo ""
|
|
|
|
# Build the application
|
|
echo "🔨 Building application..."
|
|
go build -o sitemap-api .
|
|
if [ $? -ne 0 ]; then
|
|
echo "❌ Build failed"
|
|
exit 1
|
|
fi
|
|
echo "✅ Build successful"
|
|
echo ""
|
|
|
|
# Run the application
|
|
echo "🚀 Starting server..."
|
|
echo ""
|
|
echo "Server will start on http://localhost:8080"
|
|
echo "Press Ctrl+C to stop"
|
|
echo ""
|
|
|
|
./sitemap-api
|