-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
Β·50 lines (44 loc) Β· 1.71 KB
/
setup.sh
File metadata and controls
executable file
Β·50 lines (44 loc) Β· 1.71 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
#!/bin/bash
echo "π Setting up Todo List API - Rust & Actix Web"
echo "==============================================="
# Check if Rust is installed
if ! command -v cargo &> /dev/null; then
echo "β Rust is not installed. Please install Rust first:"
echo " curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh"
exit 1
fi
# Check if MySQL is running
if ! command -v mysql &> /dev/null; then
echo "β οΈ MySQL client not found. Please ensure MySQL is installed and running."
echo " You may need to install MySQL and create a database."
fi
echo "π¦ Installing dependencies..."
cargo build
if [ $? -ne 0 ]; then
echo "β Failed to build the project. Please check the errors above."
exit 1
fi
echo "β
Project built successfully!"
echo ""
echo "π Next Steps:"
echo "1. Make sure MySQL is running"
echo "2. Create a database: CREATE DATABASE todo_db;"
echo "3. Copy .env.example to .env and update with your database credentials"
echo "4. Run the application: cargo run"
echo "5. Test the API using the provided test_api.sh script"
echo ""
echo "π API Documentation:"
echo "- Health Check: GET /health"
echo "- Register: POST /api/v1/auth/register"
echo "- Login: POST /api/v1/auth/login"
echo "- Get User: GET /api/v1/auth/me (requires auth)"
echo "- Create Todo: POST /api/v1/todos (requires auth)"
echo "- Get Todos: GET /api/v1/todos (requires auth)"
echo "- Update Todo: PUT /api/v1/todos/{id} (requires auth)"
echo "- Delete Todo: DELETE /api/v1/todos/{id} (requires auth)"
echo ""
echo "π§ Configuration:"
echo "Edit the .env file with your MySQL credentials and JWT secret."
echo ""
echo "π§ͺ Testing:"
echo "Run ./test_api.sh to test all endpoints (requires jq for JSON formatting)"