chitfund/backend/setup-and-test.sh

73 lines
2.0 KiB
Bash

#!/bin/bash
# LuckyChit Backend Setup and Test Script
# This script installs dependencies and tests the WhatsApp & Reminder features
echo "🚀 LuckyChit Backend Setup Script"
echo "================================="
echo ""
# Check if Node.js is installed
if ! command -v node &> /dev/null; then
echo "❌ Node.js is not installed"
echo "Please install Node.js from https://nodejs.org/"
exit 1
fi
echo "✅ Node.js version: $(node --version)"
echo "✅ NPM version: $(npm --version)"
echo ""
# Install dependencies
echo "📦 Installing dependencies..."
npm install
if [ $? -eq 0 ]; then
echo "✅ Dependencies installed successfully"
else
echo "❌ Failed to install dependencies"
exit 1
fi
echo ""
echo "🔍 Checking new packages..."
echo " - node-cron: $(npm list node-cron 2>/dev/null | grep node-cron || echo 'Not found')"
echo " - moment-timezone: $(npm list moment-timezone 2>/dev/null | grep moment-timezone || echo 'Not found')"
echo ""
# Check if .env file exists
if [ ! -f .env ]; then
echo "⚠️ .env file not found"
echo "📝 Creating .env from env.example..."
if [ -f env.example ]; then
cp env.example .env
echo "✅ .env file created"
echo "⚠️ Please update .env with your database credentials"
else
echo "❌ env.example not found"
echo "Please create .env file manually"
fi
else
echo "✅ .env file exists"
fi
echo ""
echo "📋 Setup Complete!"
echo ""
echo "🎯 Next Steps:"
echo " 1. Update .env file with your database credentials"
echo " 2. Run: npm run dev"
echo " 3. Test APIs at: http://localhost:3000/api"
echo ""
echo "📱 New Features:"
echo " - WhatsApp Share: http://localhost:3000/api/share"
echo " - Notifications: http://localhost:3000/api/notifications"
echo " - Payment Reminders: Automated at 9:00 AM IST daily"
echo ""
echo "📚 Documentation:"
echo " - WHATSAPP_USAGE_EXAMPLES.md"
echo " - API_DOCUMENTATION.md"
echo ""
echo "✨ Ready to launch! 🚀"