Skip to content

Microservice backend for OpenLab Scheduler project

Notifications You must be signed in to change notification settings

BCIT-LTC/scheduler-api-2

 
 

Repository files navigation

OpenLab Scheduler Api

This is the API and works as a backend for OpenLabs Scheduler WEB

OpenLab Scheduler is a web application designed to help BCIT's Nursing instructors communicate the calendar of the OpenLab to students. Students are also able to view announcements about the lab and take surveys that help instructors gain insights into students' learning.

Required Technologies

  • Node/Express
  • Docker

Running the Application

With Docker:

  1. Ensure Docker is running on your local machine

  2. In the root of the project, run docker compose up

  3. This may take a long time, be patient

    • The database will be filled with one welcome announcement
  4. Open https://localhost:8000/api to see the Rest endpoints

If you run into an error that says "can't find file \r\n", go to the docker-entrypoint.sh file and change the End of Line sequence from CRLF to LF (in the bottom right)

Making API calls with a JWT

For example, making calls to https://localhost:8000/api/announcement using Postman/Insomnia...

Calls to scheduler-api require a Bearer token to be added to the request. To create the Bearer token you have to generate a JWT token. You can use any JWT tool, but a simple, standard one can be created on jwt.io. The current JWT structure looks like the following:

let jwtToken = jwt.sign({
 email,
 first_name,
 last_name,
 role,
 school,
 program,
 authorization_checked: true,
 is_logged_in: true,
}, process.env.JWT_AUTH_SIGNING_KEY);

This structure might change to match or integrate with the BCIT SAML.

jwt-announcement.png

The JWT has to be signed with a JWT_AUTH_SIGNING_KEY which can be found in the docker-compose.yml file:

jwt-signing.png

The resulting Bearer token needs to be added to each request.

Also note: The JWT payload is where the user context is added (Admin, Student, Instructor).

About

Microservice backend for OpenLab Scheduler project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 97.7%
  • Shell 1.4%
  • Dockerfile 0.9%