#!/bin/bash # Test script for 3D Model Manager API echo "Testing 3D Model Manager API..." echo "" # Health check echo "1. Health Check:" curl -s http://localhost:3000/api/health echo -e "\n" # Register a test user echo "2. Registering test user..." REGISTER_RESPONSE=$(curl -s -X POST http://localhost:3000/api/auth/register \ -H "Content-Type: application/json" \ -d '{"username":"testuser","email":"test@example.com","password":"password123"}') echo $REGISTER_RESPONSE TOKEN=$(echo $REGISTER_RESPONSE | grep -o '"token":"[^"]*' | sed 's/"token":"//') echo -e "\nToken: $TOKEN\n" # Create a collection echo "3. Creating a collection..." curl -s -X POST http://localhost:3000/api/collections \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $TOKEN" \ -d '{"name":"My First Collection","description":"Test collection for 3D models"}' echo -e "\n" # Create some tags echo "4. Creating tags..." curl -s -X POST http://localhost:3000/api/tags \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $TOKEN" \ -d '{"name":"miniature","color":"#ff6b6b"}' echo "" curl -s -X POST http://localhost:3000/api/tags \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $TOKEN" \ -d '{"name":"terrain","color":"#4ecdc4"}' echo -e "\n" # List collections echo "5. Listing collections:" curl -s http://localhost:3000/api/collections echo -e "\n" # List tags echo "6. Listing tags:" curl -s http://localhost:3000/api/tags echo -e "\n" # List models echo "7. Listing models:" curl -s http://localhost:3000/api/models echo -e "\n" echo "API testing complete!" echo "You can now open http://localhost:3000 in your browser to use the web interface."