API Documentation
Base URL: /api — click any endpoint to expand and try it.
POST/api/auth/registervisitor▼
Register a new user account. Returns the user and a signed JWT.
| Field | Type | |
|---|---|---|
name | string | required |
email | string | required |
password | string, min 8 chars | required |
{
"message": "User registered",
"user": {
"id": "664a1f...",
"name": "Jens Debakker",
"role": "user"
},
"token": "eyJhbGci..."
}
POST/api/auth/loginvisitor▼
Log in and receive a JWT token.
| Field | Type | |
|---|---|---|
email | string | required |
password | string | required |
{
"message": "Logged in",
"token": "eyJhbGci...",
"user": { "id": "664a1f...", "name": "Jens Debakker", "role": "user" }
}
GET/api/auth/meuser▼
Return the profile of the currently logged-in user.
No body or path parameters.
{
"user": { "_id": "664a1f...", "name": "Jens Debakker", "role": "user" }
}
GET/api/schoolsvisitor▼
Return all schools.
None.
{
"data": [{ "_id": "664a1f...", "name": "VIVES Hogeschool", "city": "Bruges", "classes": [...] }]
}
GET/api/schools/:schoolIdvisitor▼
Return a single school by its ID.
| Param | Type | |
|---|---|---|
schoolId | ObjectId | required |
{
"data": { "_id": "664a1f...", "name": "VIVES Hogeschool", "classes": [...] }
}
POST/api/schoolsadmin▼
Create a new school. Requires admin role.
| Field | Type | |
|---|---|---|
name | string | required |
city | string | optional |
description | string | optional |
{
"data": { "_id": "664a1f...", "name": "VIVES Hogeschool", "city": "Bruges", "classes": [] }
}
PUT/api/schools/:schoolIdadmin▼
Update an existing school. Requires admin role.
| Param | Type | |
|---|---|---|
schoolId | ObjectId | required |
| Field | Type | |
|---|---|---|
name | string | required |
city | string | optional |
{
"data": { "_id": "664a1f...", "name": "VIVES Updated", "city": "Kortrijk" }
}
DELETE/api/schools/:schoolIdadmin▼
Delete a school and all its embedded data.
| Param | Type | |
|---|---|---|
schoolId | ObjectId | required |
GET/api/schools/:schoolId/classesvisitor▼
Return all embedded classes for a school.
| Param | Type | |
|---|---|---|
schoolId | ObjectId | required |
{
"data": [{ "_id": "664b2a...", "name": "TI-B", "teacherName": "Prof. Peeters" }]
}
GET/api/classesvisitor▼
Return all classes across all schools.
None.
{
"data": [{ "_id": "664b2a...", "name": "TI-B", "schoolId": "664a1f..." }]
}
GET/api/classes/:classIdvisitor▼
Return a single class by its embedded ID.
| Param | Type | |
|---|---|---|
classId | ObjectId | required |
{
"data": { "_id": "664b2a...", "name": "TI-B", "schoolId": "664a1f..." }
}
POST/api/schools/:schoolId/classesadmin▼
Create a class inside a school. Requires admin role.
| Param | Type | |
|---|---|---|
schoolId | ObjectId | required |
| Field | Type | |
|---|---|---|
name | string | required |
teacherName | string | optional |
academicYear | string | optional |
{
"data": { "_id": "664b2a...", "name": "TI-B", "students": [], "schoolId": "664a1f..." }
}
PUT/api/classes/:classIdadmin▼
Update a class. Requires admin role.
| Param | Type | |
|---|---|---|
classId | ObjectId | required |
| Field | Type | |
|---|---|---|
name | string | required |
teacherName | string | optional |
academicYear | string | optional |
{
"data": { "_id": "664b2a...", "name": "TI-B Updated", "schoolId": "664a1f..." }
}
DELETE/api/classes/:classIdadmin▼
Delete a class and all its embedded students.
| Param | Type | |
|---|---|---|
classId | ObjectId | required |
GET/api/classes/:classId/studentsvisitor▼
Return all embedded students for a class.
| Param | Type | |
|---|---|---|
classId | ObjectId | required |
{
"data": [{ "_id": "664c3b...", "firstName": "Jan", "lastName": "Janssen" }]
}
GET/api/studentsvisitor▼
Return all students across all schools.
None.
{
"data": [{ "_id": "664c3b...", "firstName": "Jan", "lastName": "Janssen", "classId": "664b2a..." }]
}
GET/api/students/:studentIdvisitor▼
Return a single student by their embedded ID.
| Param | Type | |
|---|---|---|
studentId | ObjectId | required |
{
"data": { "_id": "664c3b...", "firstName": "Jan", "lastName": "Janssen" }
}
POST/api/classes/:classId/studentsadmin▼
Create a student inside a class. Requires admin role.
| Param | Type | |
|---|---|---|
classId | ObjectId | required |
| Field | Type | |
|---|---|---|
firstName | string | required |
lastName | string | required |
email | string | optional |
{
"data": { "_id": "664c3b...", "firstName": "Jan", "exercises": [], "classId": "664b2a..." }
}
PUT/api/students/:studentIdadmin▼
Update a student. Requires admin role.
| Param | Type | |
|---|---|---|
studentId | ObjectId | required |
| Field | Type | |
|---|---|---|
firstName | string | required |
lastName | string | required |
email | string | optional |
{
"data": { "_id": "664c3b...", "firstName": "Jan", "lastName": "Janssen Updated" }
}
DELETE/api/students/:studentIdadmin▼
Delete a student and all their exercises.
| Param | Type | |
|---|---|---|
studentId | ObjectId | required |
GET/api/students/:studentId/exercisesvisitor▼
Return all exercises for a student.
| Param | Type | |
|---|---|---|
studentId | ObjectId | required |
{
"data": [{ "_id": "664d4c...", "title": "Exercise 1", "scores": [...] }]
}
GET/api/exercisesvisitor▼
Return all exercises across all students.
None.
{
"data": [{ "_id": "664d4c...", "title": "Exercise 1", "studentId": "664c3b..." }]
}
GET/api/exercises/:exerciseIdvisitor▼
Return a single exercise by its embedded ID.
| Param | Type | |
|---|---|---|
exerciseId | ObjectId | required |
{
"data": { "_id": "664d4c...", "title": "Exercise 1", "scores": [...] }
}
POST/api/students/:studentId/exercisesuser▼
Create an exercise for a student. Any logged-in user can do this.
| Param | Type | |
|---|---|---|
studentId | ObjectId | required |
| Field | Type | |
|---|---|---|
title | string | required |
description | string | optional |
dueAt | ISO date | optional |
{
"data": { "_id": "664d4c...", "title": "Exercise 1", "scores": [] }
}
PUT/api/exercises/:exerciseIduser▼
Update an exercise.
| Param | Type | |
|---|---|---|
exerciseId | ObjectId | required |
| Field | Type | |
|---|---|---|
title | string | required |
description | string | optional |
dueAt | ISO date | optional |
{
"data": { "_id": "664d4c...", "title": "Exercise 1 Updated" }
}
DELETE/api/exercises/:exerciseIduser▼
Delete an exercise and all its scores.
| Param | Type | |
|---|---|---|
exerciseId | ObjectId | required |
GET/api/exercises/:exerciseId/scoresvisitor▼
Return all scores for an exercise.
| Param | Type | |
|---|---|---|
exerciseId | ObjectId | required |
{
"data": [
{ "_id": "664e5d...", "label": "Theory", "value": 85 },
{ "_id": "664e5e...", "label": "Practical", "value": 92 }
]
}
POST/api/exercises/:exerciseId/scoresuser▼
Add a score to an exercise. Value must be 0–100.
| Param | Type | |
|---|---|---|
exerciseId | ObjectId | required |
| Field | Type | |
|---|---|---|
label | string | required |
value | number 0–100 | required |
{
"data": {
"_id": "664d4c...",
"title": "Exercise 1",
"scores": [{ "_id": "664e5d...", "label": "Theory", "value": 85 }]
}
}
GET/api/statusvisitor▼
Health check — returns server status and uptime in seconds.
None.
{
"status": "ok",
"uptime": 3724.5
}