Skip to content

Commit 9d36164

Browse files
author
chanakyavasantha
committed
mongo client initialization modified
1 parent b800144 commit 9d36164

File tree

2 files changed

+52
-2
lines changed

2 files changed

+52
-2
lines changed

app/dependencies.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ def get_mongodb_collection():
2626
# Add SSL configuration for Azure compatibility
2727
client = MongoClient(
2828
mongodb_uri,
29-
ssl=True,
30-
ssl_cert_reqs=ssl.CERT_NONE,
29+
tls=True,
30+
tlsAllowInvalidCertificates=True,
3131
serverSelectionTimeoutMS=30000,
3232
connectTimeoutMS=30000,
3333
socketTimeoutMS=30000

test_endpoints.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
3+
# MarketMap API Endpoint Testing Script
4+
# Make sure your backend server is running on localhost:8000
5+
6+
BASE_URL="http://localhost:8000"
7+
echo "Testing MarketMap API endpoints..."
8+
echo "Base URL: $BASE_URL"
9+
echo "==========================================="
10+
11+
# Test 1: Root endpoint
12+
echo "\n1. Testing root endpoint..."
13+
curl -s -w "\nStatus: %{http_code}\n" "$BASE_URL/"
14+
15+
# Test 2: Debug environment endpoint
16+
echo "\n2. Testing debug environment..."
17+
curl -s -w "\nStatus: %{http_code}\n" "$BASE_URL/debug/env"
18+
19+
# Test 3: Indices status endpoint (the one that was failing)
20+
echo "\n3. Testing indices status endpoint..."
21+
curl -s -w "\nStatus: %{http_code}\n" "$BASE_URL/api/indices/status"
22+
23+
# Test 4: Last updated endpoint
24+
echo "\n4. Testing last updated endpoint..."
25+
curl -s -w "\nStatus: %{http_code}\n" "$BASE_URL/api/indices/last-updated"
26+
27+
# Test 5: All indices endpoint
28+
echo "\n5. Testing all indices endpoint..."
29+
curl -s -w "\nStatus: %{http_code}\n" "$BASE_URL/api/indices"
30+
31+
# Test 6: Specific index endpoints (common market indices)
32+
echo "\n6. Testing specific index endpoints..."
33+
INDICES=("^GSPC" "^DJI" "^IXIC" "^FTSE" "^N225")
34+
35+
for index in "${INDICES[@]}"; do
36+
echo "\n Testing $index..."
37+
curl -s -w "\nStatus: %{http_code}\n" "$BASE_URL/api/indices/$index"
38+
done
39+
40+
# Test 7: Health check with detailed output
41+
echo "\n7. Detailed health check..."
42+
echo "Testing with verbose output:"
43+
curl -v "$BASE_URL/api/indices/status" 2>&1 | head -20
44+
45+
echo "\n==========================================="
46+
echo "Testing complete!"
47+
echo "\nIf you see 500 errors, check:"
48+
echo "1. MongoDB connection (MONGODB_URI environment variable)"
49+
echo "2. Backend server logs for detailed error messages"
50+
echo "3. SSL/TLS configuration in dependencies.py"

0 commit comments

Comments
 (0)