#!/bin/bash # Video to MP3 Transcriptor Server Starter # This script starts the API server on port 8888 echo "==========================================" echo "Video to MP3 Transcriptor API" echo "==========================================" echo "" # Check if node is installed if ! command -v node &> /dev/null then echo "Error: Node.js is not installed" echo "Please install Node.js from https://nodejs.org/" exit 1 fi # Check if npm is installed if ! command -v npm &> /dev/null then echo "Error: npm is not installed" echo "Please install npm" exit 1 fi # Check if .env file exists if [ ! -f .env ]; then echo "Warning: .env file not found" echo "Creating .env file..." echo "OPENAI_API_KEY=" > .env echo "PORT=8888" >> .env echo "OUTPUT_DIR=./output" >> .env echo "" echo "Please edit .env and add your OPENAI_API_KEY" echo "" fi # Check if node_modules exists if [ ! -d "node_modules" ]; then echo "Installing dependencies..." npm install echo "" fi # Kill any process using port 8888 echo "Checking port 8888..." npx kill-port 8888 2>/dev/null echo "" echo "Starting server on http://localhost:8888" echo "Press Ctrl+C to stop the server" echo "" echo "==========================================" echo "" # Start the server npm run server