Course

Creates a new course object

Constructor

new Course(id) → {Course}

Parameters:
NameTypeDescription
idstringCourse id (from courses.json)
Returns:
- Course object created
Type: 
Course
Example
const course = new Course("js101")

Classes

Course

Methods

(async) display(id) → {object}

Displays course info on /courses
Parameters:
NameTypeDefaultDescription
idstringnouserId of the user to check for where to display courses
Returns:
- Course data or {}
Type: 
object
Example
Course.display("SOMEUSERID")
Course.display() // for a user logged out

get() → {object}

Returns Course data
Returns:
- Course data or {}
Type: 
object
Example
const courseData = course.get()

getSections() → {Array.<Section>}

Get all sections with this course as a parent
Returns:
- Sorted list of lessons by id in ascending order
Type: 
Array.<Section>
Example
course.getSections() // [Lesson1, Lesson2]

(static) getAll() → {Array.<Course>}

Get all courses in courses.json
Returns:
- List of courses
Type: 
Array.<Course>
Example
Course.getAll() // [Course1, Course2]