A Learning Management System, or LMS, is software that delivers an online course. Everspring uses several of them in its partnerships with leading universities. In this assignment, you will make a tiny one – TinyLMS. TinyLMS won’t have all the features of a real LMS, of course. TinyLMS will have the ability to do the following:
• Create, edit, and delete Courses.
o A Course has two fields: name and courseCode.
• Create, edit, and delete Users.
o A User has two fields: name and type (“student” or “instructor”)
• Add and remove Users from Courses
TinyLMS will just have a backend API to accomplish the above.
- Java 8
- Maven
- MongoDB (New tables
course
anduser
will be created, make sure you have space for them) - Port 8080
- Clone the project to your computer
git clone https://github.com/lichao0817/everspring-practicum.git
cd everspring-practicum
- Build the app with Maven:
mvn package
- Run the app
java -jar target/tinylms-1.0.0.jar
- Different users with same names should be allowed to register.
- Each class only has one section.
- To make the url thorter, assume that this is the only version of the API. So no version number is needed in the API url.
- Only
GET
,PUT
,POST
, andDELETE
are used, other http methods will generate an error. - Only the URLs metioned in this documentation plus the default URL are accessible, other URLs would generate an error handled by Spring.
- Status code is sufficient for methods that are not
GET
in order for simplicity and short payload. - Course code is case insensitive in order to avoid confusion.
- Username is case sensitive in order to allow more flexibilities.
GET http://localhost:8080/users
200
: the user list is successfully returned
204
: there are no users currently
{
"data": {
"users": [
{
"courses": [
"cs302"
],
"username": "jsmith",
"name": "Jon Smith",
"type": "student"
},
{
"courses": [
"cs302"
],
"username": "asmith",
"name": "Adam Smith",
"type": "instructor"
},
{
"courses": [
"math340"
],
"username": "Ablk",
"name": "Alice Black",
"type": "student"
}
]
}
}
courses
: the course codes of the courses that the users enrolled
username
: the id string
of the user, case sensitive and contains no space
name
: the name string
of the user, case sensitive
type
: indicate the user type, currently only support "instructor" and "student", case insensitive
POST http://localhost:8080/users
{
"name":"John Doe",
"username":"jdoe",
"type":"instructor"
}
201
: the user has been successfully created.
400
: either the username or the type is not valid
409
: an user with the same username
has already been created
GET http://localhost:8080/users/{username}
200
: the user can be successfully found
404
: the user cannot be found
{
"data": {
"user": {
"courses": [],
"username": "jsmith",
"name": "Jon Smith",
"type": "student"
}
}
}
PUT http://localhost:8080/users/{username}
{
"name":"John Smith",
"username":"jsmith",
"type":"student"
}
204
: the user has been successfully updated
404
: the user cannot be found
DELETE http://localhost:8080/users/{username}
204
: the user can be successfully found
404
: the user cannot be found
GET http://localhost:8080/classes
200
: the class list is successfully returned
204
: there are no classes currently
{
"data": {
"courses": [
{
"users": [
"Ablk"
],
"courseCode": "math340",
"name": "Linear Algebra"
},
{
"users": [
"jsmith",
"asmith"
],
"courseCode": "cs302",
"name": "Intro to Computer Science"
}
]
}
}
users
: the list
of users that have been added to the course
name
: the name string
of the course
courseCode
: the id string
of the course, is case insensitive and cannot be changed once created
POST http://localhost:8080/classes
{
"name":"Intro to CS",
"courseCode":"cs302"
}
201
: the class has been successfully created.
409
: a class with the same courseCode
has already been created
GET http://localhost:8080/classes/{courseCode}
200
: the class can be successfully found
404
: the class cannot be found
{
"data": {
"course": {
"users": [],
"courseCode": "math340",
"name": "Linear Algebra"
}
}
}
PUT http://localhost:8080/classes/{courseCode}
{
"name":"Intro to CS",
"courseCode":"cs302"
}
204
: the class has been successfully updated
404
: the class cannot be found
DELETE http://localhost:8080/classes/{courseCode}
204
: the class can be successfully found
404
: the class cannot be found
PUT or POST http://localhost:8080/classes/{courseCode}/users/{username}
201
: the class has been successfully enrolled
208
: the user has already enrolled
400
: either the user or class does not exist
DELETE http://localhost:8080/classes/{courseCode}/users/{username}
204
: the class has been successfully unenrolled
400
: either the user or class does not exist
404
: the user is not in the class roster
Enrollment information are available through either user
or class
service metioned above.