All routes respond with a JSON.
If an error occurs, the response contains only one field of error.
If successfull, the response is specified below.
Only two roles are valid - "Teacher" and "Student"
Type : POST
Path : /auth/signup
Request :
{
username: String,
email: String,
password: String,
role: String
}
{
user : {
username: String,
email: String,
role: String
}
}
Type : POST
Path : /auth/signin
Request:
{
email: String,
password: String
}
{
user:{
username: String,
email: String,
role: String
}
}
Type : GET
Path : /auth/logout
Response:
Type : GET
Path : /auth/google/login
Response:
{
url : URL // to be redirected to for consent
}
Type : GET
Path : /auth/google/callback
Response:
{
status: Number, // Determines if user exists in the database
user:{
email: String,
username: String,
role: String, // when status = 1
picture: URL // when status = 0
},
redirect : URL // when status = 0
}
GOOGLE SIGNUP REQUEST AFTER CALLBACK
Type : POST
Path : /auth/google/signup
Request:
{
user: {
username: String,
email: String,
role: String
}
}
Type : GET
Path : /class/
Response :
{
classes : [{
_id: ObjectID,
title: String,
subjectCode: String,
books: [{ String }],
link: String,
admin: ObjectID,
students: [{
user: Email,
points: Number,
}],
}]
}
Type : GET
Path : /class/:id
Response :
{
{
_id: ObjectID,
title: String,
subjectCode: String,
books: [{ String }],
link: String,
admin: ObjectID,
students: [{
user: Email,
points: Number,
}],
}
}
Type : POST
Path : /class/
Request :
{
title: String,
subjectCode: String,
books: [{ String }],
link: String,
students: [{
user: Email,
points: Number,
}],
}
Type : PATCH
Path : /class/:id
Request :
{
title: String,
subjectCode: String,
books: [{ String }],
link: String,
students: [{
user: Email,
points: Number,
}],
}
Type : PATCH
Path : /class/join/:id
Response :
UNENROLL FROM AN EXISTING CLASS
Type : PATCH
Path : /class/unenroll/:id
Response :
Type : DELETE
Path : /class/:id
Response :
Type : GET
Path : /class/:id/posts
Response :
{
posts : {
title: String,
content: String,
author: ObjectID,
classID: ObjectID
}
}
Type : POST
Path : /class/:id/posts
Request :
{
title: String,
content: String,
}
Type : PATCH
Path : /posts/:id
Request :
{
title: String,
content: String,
}
GET ALL ASSIGNMENTS IN A CLASS
Type : GET
Path : /class/:id/assign
Response :
{
assign:[{
title: String,,
questions: [
{
question: String,
options: [String],
correct: String,
points: Number, // default: 1
},
],
submissions: [
{
user: String,
points: Number, // default: 0
time: Date, // default: Date.now
},
],
classID: ObjectID,
due: Date,
}]
}
Type : GET
Path : /assign/:id
Response :
{
title: String,,
questions: [
{
question: String,
options: [String],
correct: String,
points: Number, // default: 1
},
],
submissions: [
{
user: String,
points: Number, // default: 0
time: Date, // default: Date.now
},
],
classID: ObjectID,
due: Date,
}
CREATE ASSIGNMENT IN A CLASS
Type : POST
Path : /class/:id/assign
Request :
{
title: String,,
questions: [
{
question: String,
options: [String],
correct: String,
points: Number, // default: 1
},
],
due: Date,
}
Type : PATCH
Path : /assign/:id
Request :
{
title: String,,
questions: [
{
question: String,
options: [String],
correct: String,
points: Number, // default: 1
},
],
due: Date,
}
Type : PATCH
Path : /assign/:id/submit
Request :