Skip to content

wm-classified/backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WM Classified Backend

Server for WM Classified.

API Endpoints

/catalog/semesters

Example:

fetch(URL + '/catalog/semesters')

Response: an array of available semesters

[ 'fall_2015', 'spring_2016' ]

/catalog/:semester

Example:

fetch(URL + '/catalog/spring_2016')

Response: an array of all courses for the given semester

[
  {
    status: "OPEN",
    attr: "  ",
    creditHours: "3",
    courseId: "MATH 311 01 ",
    meetTimes: "1300-1350",
    title: "Elementary Analysis",
    meetDays: "MWF ",
    currEnr: "23",
    instructor: "Humber, Cary",
    crn: "20232",
    seatsAvail: "2"
  },
  {
    status: "OPEN",
    attr: "MATO",
    creditHours: "3",
    courseId: "MATH 323 01 ",
    meetTimes: "0930-1050",
    title: "Intro Operations Research I",
    meetDays: "TR ",
    currEnr: "23",
    instructor: "Ninh, Anh",
    crn: "24060",
    seatsAvail: "12*"
  }
]

/posts/:semester

Example:

fetch(URL + '/posts/spring_2016')

Response: an array of posts for a given semester

[
  {
    "courseId":"ANTH 150 01 ",
    "emails":[
      "student@wm.edu"
    ]
  },
  {
    "courseId":"APSC 401 01 ",
    "emails":[
      "student@wm.edu"
    ]
  }
]

/requests/:semester

Example:

fetch(URL + '/requests/spring_2016')

Response: an array of requests for a given semester

[
  {
    "courseId":"ANTH 150 01 ",
    "emails":[
      "student@wm.edu"
    ]
  },
  {
    "courseId":"APSC 401 01 ",
    "emails":[
      "student@wm.edu"
    ]
  }
]

/submit/post/:semester

The request body must be a JSON object structured like so:

{
  'courseId': <String>
  'email': <String>
}

Example:

fetch(`${URL}/submit/post/spring_2016`, {
  method: 'POST',
  headers: new Headers({ 'Content-Type': 'application/json' }),
  body: JSON.stringify({ courseId: 'APSC 401 01 ', email: 'student@wm.edu'  })
})

Response:

  • ok: the data was successfully added
  • 400: the requested semester is not available

/submit/request/:semester

The request body must be a JSON object structured like so:

{
  'courseId': <String>
  'email': <String>
}

Example

fetch(`${URL}/submit/request/spring_2016`, {
  method: 'POST',
  headers: new Headers({ 'Content-Type': 'application/json' }),
  body: JSON.stringify({ courseId: 'APSC 401 01 ', email: 'student@wm.edu'  })
})

Response:

  • ok: the data was successfully added
  • 400: the requested semester is not available

Developing

Depends on a global install of babel-cli

npm i -g babel-cli

For development, run:

npm install
npm start

The server will be listening on port 8080

Releases

No releases published

Packages

No packages published