-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.sh
More file actions
54 lines (46 loc) · 1.15 KB
/
dev.sh
File metadata and controls
54 lines (46 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env bash
# Start zesFin backend (port 48080) + frontend (port 5173) in one command.
# Usage: ./dev.sh - start both
# ./dev.sh backend - backend only
# ./dev.sh frontend - frontend only
set -e
ROOT="$(cd "$(dirname "$0")" && pwd)"
export JAVA_HOME="C:\\Users\\cpereiro\\scoop\\apps\\temurin21-jdk\\current"
start_backend() {
echo ">> Starting backend on :48080 ..."
cd "$ROOT"
./mvnw spring-boot:run -q &
BACKEND_PID=$!
echo " Backend PID: $BACKEND_PID"
}
start_frontend() {
echo ">> Starting frontend on :5173 ..."
cd "$ROOT/frontend"
npm run dev &
FRONTEND_PID=$!
echo " Frontend PID: $FRONTEND_PID"
}
cleanup() {
echo ""
echo ">> Shutting down..."
[ -n "$BACKEND_PID" ] && kill "$BACKEND_PID" 2>/dev/null
[ -n "$FRONTEND_PID" ] && kill "$FRONTEND_PID" 2>/dev/null
wait 2>/dev/null
echo ">> Done."
}
trap cleanup EXIT INT TERM
case "${1:-all}" in
backend) start_backend ;;
frontend) start_frontend ;;
all)
start_backend
start_frontend
;;
*)
echo "Usage: $0 [backend|frontend|all]"
exit 1
;;
esac
echo ""
echo ">> zesFin running — press Ctrl+C to stop"
wait