-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapi-documentation.html
More file actions
400 lines (362 loc) Β· 11 KB
/
Copy pathapi-documentation.html
File metadata and controls
400 lines (362 loc) Β· 11 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Study Assistant Platform - API Documentation</title>
<style>
body {
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
margin: 0;
padding: 0;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
.header {
text-align: center;
color: white;
margin-bottom: 40px;
}
.header h1 {
font-size: 3rem;
margin-bottom: 10px;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}
.header p {
font-size: 1.2rem;
opacity: 0.9;
}
.services-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 20px;
margin-bottom: 40px;
}
.service-card {
background: white;
border-radius: 15px;
padding: 30px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.service-card:hover {
transform: translateY(-5px);
box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}
.service-header {
display: flex;
align-items: center;
margin-bottom: 20px;
}
.service-icon {
font-size: 2rem;
margin-right: 15px;
}
.service-title {
font-size: 1.5rem;
font-weight: bold;
color: #333;
}
.service-description {
color: #666;
margin-bottom: 20px;
line-height: 1.6;
}
.service-links {
display: flex;
gap: 10px;
flex-wrap: wrap;
}
.btn {
padding: 10px 20px;
border-radius: 8px;
text-decoration: none;
font-weight: 500;
transition: all 0.3s ease;
border: none;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 5px;
}
.btn-primary {
background: #4f46e5;
color: white;
}
.btn-primary:hover {
background: #4338ca;
}
.btn-secondary {
background: #e5e7eb;
color: #374151;
}
.btn-secondary:hover {
background: #d1d5db;
}
.quick-start {
background: white;
border-radius: 15px;
padding: 30px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
margin-bottom: 40px;
}
.quick-start h2 {
color: #333;
margin-bottom: 20px;
}
.code-block {
background: #1f2937;
color: #f9fafb;
padding: 20px;
border-radius: 8px;
font-family: "Courier New", monospace;
margin: 15px 0;
overflow-x: auto;
}
.status-indicator {
display: inline-block;
width: 12px;
height: 12px;
border-radius: 50%;
margin-right: 8px;
}
.status-online {
background: #10b981;
}
.status-offline {
background: #ef4444;
}
.features {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 20px;
margin-top: 30px;
}
.feature {
background: #f8fafc;
padding: 20px;
border-radius: 10px;
border-left: 4px solid #4f46e5;
}
.footer {
text-align: center;
color: white;
opacity: 0.8;
margin-top: 40px;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>π Study Assistant Platform</h1>
<p>Comprehensive API Documentation & Interactive Testing</p>
</div>
<div class="quick-start">
<h2>π Quick Start</h2>
<p>To start using the APIs, you'll need to authenticate first:</p>
<div class="code-block">
# 1. Register a new user curl -X POST
http://localhost:8083/api/auth/register \ -H "Content-Type:
application/json" \ -d '{ "email": "user@example.com", "name": "John
Doe", "password": "securePassword123" }' # 2. Login to get JWT token
curl -X POST http://localhost:8083/api/auth/login \ -H "Content-Type:
application/json" \ -d '{ "email": "user@example.com", "password":
"securePassword123" }' # 3. Use the token for authenticated requests
curl -X GET http://localhost:8082/api/flashcard/decks/user \ -H
"Authorization: Bearer YOUR_JWT_TOKEN_HERE"
</div>
</div>
<div class="services-grid">
<div class="service-card">
<div class="service-header">
<div class="service-icon">π</div>
<div class="service-title">Auth Service</div>
</div>
<div class="service-description">
<span class="status-indicator status-online"></span>
Port 8083 - User registration, authentication, and JWT token
management
</div>
<div class="service-links">
<a
href="http://localhost:8083/swagger-ui.html"
class="btn btn-primary"
target="_blank"
>
π Swagger UI
</a>
<a
href="http://localhost:8083/api-docs"
class="btn btn-secondary"
target="_blank"
>
π OpenAPI JSON
</a>
</div>
</div>
<div class="service-card">
<div class="service-header">
<div class="service-icon">π</div>
<div class="service-title">Flashcard Service</div>
</div>
<div class="service-description">
<span class="status-indicator status-online"></span>
Port 8082 - Flashcard deck and card management for study sessions
</div>
<div class="service-links">
<a
href="http://localhost:8082/swagger-ui.html"
class="btn btn-primary"
target="_blank"
>
π Swagger UI
</a>
<a
href="http://localhost:8082/api-docs"
class="btn btn-secondary"
target="_blank"
>
π OpenAPI JSON
</a>
</div>
</div>
<div class="service-card">
<div class="service-header">
<div class="service-icon">π§ </div>
<div class="service-title">Quiz Service</div>
</div>
<div class="service-description">
<span class="status-indicator status-online"></span>
Port 8081 - Course management, quiz questions, and answer
submissions
</div>
<div class="service-links">
<a
href="http://localhost:8081/swagger-ui.html"
class="btn btn-primary"
target="_blank"
>
π Swagger UI
</a>
<a
href="http://localhost:8081/api-docs"
class="btn btn-secondary"
target="_blank"
>
π OpenAPI JSON
</a>
</div>
</div>
<div class="service-card">
<div class="service-header">
<div class="service-icon">π€</div>
<div class="service-title">GenAI Service</div>
</div>
<div class="service-description">
<span class="status-indicator status-online"></span>
Port 5001 - AI-powered feedback generation using local LLM models
</div>
<div class="service-links">
<a
href="http://localhost:5001/docs"
class="btn btn-primary"
target="_blank"
>
π FastAPI Docs
</a>
<a
href="http://localhost:5001/redoc"
class="btn btn-secondary"
target="_blank"
>
π ReDoc
</a>
</div>
</div>
</div>
<div class="quick-start">
<h2>β¨ Features</h2>
<div class="features">
<div class="feature">
<h3>π JWT Authentication</h3>
<p>
Secure token-based authentication with Bearer token support in
Swagger UI
</p>
</div>
<div class="feature">
<h3>π± Interactive Testing</h3>
<p>
Test all endpoints directly from the Swagger UI without external
tools
</p>
</div>
<div class="feature">
<h3>π Real-time Examples</h3>
<p>Live request/response examples with proper schema validation</p>
</div>
<div class="feature">
<h3>π Monitoring Ready</h3>
<p>Prometheus metrics endpoints exposed at /actuator/prometheus</p>
</div>
</div>
</div>
<div class="quick-start">
<h2>π§ Development URLs</h2>
<div class="code-block">
# Service Health Checks Auth Service:
http://localhost:8083/api/auth/test Flashcard Service:
http://localhost:8082/api/flashcard/test Quiz Service:
http://localhost:8081/api/quiz/test GenAI Service:
http://localhost:5001/health # Monitoring Endpoints Prometheus
Metrics: http://localhost:808[1-3]/actuator/prometheus Health Checks:
http://localhost:808[1-3]/actuator/health
</div>
</div>
<div class="footer">
<p>
π― Study Assistant Platform - Built with Spring Boot, FastAPI &
OpenAPI 3.0
</p>
<p>
For support, check the service logs:
<code>docker-compose logs <service-name></code>
</p>
</div>
</div>
<script>
// Check service status and update indicators
async function checkServiceStatus() {
const services = [
{ url: "http://localhost:8083/api/auth/test", name: "auth" },
{
url: "http://localhost:8082/api/flashcard/test",
name: "flashcard",
},
{ url: "http://localhost:8081/api/quiz/test", name: "quiz" },
{ url: "http://localhost:5001/health", name: "genai" },
];
services.forEach(async (service) => {
try {
const response = await fetch(service.url, { mode: "no-cors" });
// Since we can't read the response due to CORS, we'll assume it's online if no error
} catch (error) {
// If there's an error, mark as offline
const indicators = document.querySelectorAll(
`.service-card .status-indicator`
);
// This is a simplified version - in a real app you'd have proper service health checks
}
});
}
// Check status on page load
// checkServiceStatus();
</script>
</body>
</html>