#!/usr/bin/env bash
set -euo pipefail

ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

( cd "$ROOT/SproutWorkCollect-Backend-Golang" && go run . ) &
BACK_PID=$!

( cd "$ROOT/SproutWorkCollect-Frontend" && npm run dev ) &
FRONT_PID=$!

echo "Backend PID: $BACK_PID"
echo "Frontend PID: $FRONT_PID"
echo "Press Ctrl+C to stop both."

trap 'kill $BACK_PID $FRONT_PID 2>/dev/null || true' INT TERM
wait
