Z-Image-Turbo-API / setup-node.sh
mohamedislegend4's picture
Upload 9 files
d6e90da verified
Raw
History Blame Contribute Delete
1.45 kB
#!/bin/bash
# Z-Image-Turbo API Wrapper (Node.js) - Quick Start Script
set -e
echo "========================================"
echo "Z-Image-Turbo API - Node.js Quick Setup"
echo "========================================"
echo ""
# Check Node.js
if ! command -v node &> /dev/null; then
echo "❌ Node.js is not installed"
echo "Install from: https://nodejs.org/"
exit 1
fi
NODE_VERSION=$(node --version)
NPM_VERSION=$(npm --version)
echo "✓ Node.js $NODE_VERSION installed"
echo "✓ npm $NPM_VERSION installed"
# Install dependencies
echo ""
echo "Installing dependencies..."
npm ci --silent
echo "✓ Dependencies installed"
# Create .env if it doesn't exist
if [ ! -f ".env" ]; then
cat > .env << EOF
PORT=5000
NODE_ENV=development
GRADIO_API_URL=https://mohamedislegend4-z-image-turbo-api.hf.space
EOF
echo "✓ .env file created"
fi
echo ""
echo "========================================"
echo "Setup Complete!"
echo "========================================"
echo ""
echo "To start the development server:"
echo " npm run dev"
echo ""
echo "To start the production server:"
echo " npm start"
echo ""
echo "To use PM2 (recommended for production):"
echo " npm install -g pm2"
echo " pm2 start server.js"
echo ""
echo "To test the API:"
echo " curl http://localhost:5000/health"
echo " curl -X POST http://localhost:5000/api/generate -H 'Content-Type: application/json' -d '{\"prompt\": \"A sunset\"}'"
echo ""