40 lines
1.1 KiB
Bash
Executable File
40 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Run Mock Server Script
|
|
# This script starts the Rust mock server for testing the file browser component
|
|
|
|
set -e
|
|
|
|
echo "🚀 Starting Mock File Server..."
|
|
echo "📁 This server provides the same API as src/files.py for testing"
|
|
echo ""
|
|
|
|
# Change to mock server directory
|
|
cd "$(dirname "$0")/mock-server"
|
|
|
|
# Check if Rust is installed
|
|
if ! command -v cargo &> /dev/null; then
|
|
echo "❌ Error: Rust/Cargo is not installed"
|
|
echo "Please install Rust from https://rustup.rs/"
|
|
exit 1
|
|
fi
|
|
|
|
# Build and run the mock server
|
|
echo "🔨 Building mock server..."
|
|
cargo build --release
|
|
|
|
echo "🌐 Starting server on http://localhost:3001"
|
|
echo "📋 Available endpoints:"
|
|
echo " GET /files/list/<path> - List directory contents"
|
|
echo " POST /files/dirs/<path> - Create directory"
|
|
echo " DELETE /files/delete/<path> - Delete file/directory"
|
|
echo " POST /files/upload - Upload file (TUS)"
|
|
echo " GET /files/download/<path> - Download file"
|
|
echo " GET /health - Health check"
|
|
echo ""
|
|
echo "💡 Use Ctrl+C to stop the server"
|
|
echo ""
|
|
|
|
# Run the server
|
|
cargo run --release
|