The server is designed to be deployed to Google Cloud Platform and to run on Google Cloud Functions. It also uses Google Cloud Firestore to cache course schedules. The server is implemented in JavaScript except for the utils and constants which are in TypeScript. The server has a get method called "get_student_data" which when called with the student's id returns the student schedule for the provided id.
- after opening a terminal in the server folder, run
npm i
to install the required dependencies - run
firebase functions:config:set credentials.username="USERNAME" credentials.password="PASSWORD"
and replaceUSERNAME
andPASSWORD
with you GUC username and password - run
npm run setup-env
to save the environment variables in.runtimeconfig.json
. This is required for the local development server to have access to the credentials - create the
secret.js
file that contains theprepare_courses
key - run
npm run serve
to run the development server on localhost - call
prepare_courses
with your key - now you have an api exposes on
http://localhost:5001/gucschedule/europe-west1/get_student_schedule
(by default) :)
- The student's enrolled courses are fetched from the student data report.
- For each course the student is enrolled in, the server gets the course schedule from the cache, if it is available. If the schedule is not in the cache, then the server fetches the schedule, saves the schedule in cache and returns the data.
- The course schedules are filtered for the tutorials that the student attends and then the student schedule is returned.