Skip to content

uCredit-Dev/uCredit-API

Repository files navigation

uCredit-API

This is the backend for uCredit, 4-year course planning, streamlined. Deployed on Render.

Please allow a few seconds for the server to start up.

Structure

  • API routes saved in ./routes
  • Mongoose Schema saved in ./model
  • Tests saved in ./tests
  • Database connection made in ./data/db.js

Run locally

Pre-requisites: npm, git, mongodb

  1. Clone this repository.
git clone https://github.com/uCredit-Dev/uCredit-API.git
  1. Install dependencies.
npm i
  1. Create .env file at the root. Copy paste .env for development! (Ask a dev for access)
touch .env
  1. Start server.
npm start
  1. Navigate to http://localhost:4567/

Run locally with docker

To run program from a fresh clone:

  1. Update .env file with the following:
DEBUG=True
SIS_API_KEY=YOUR_API_KEY
  1. Build docker:
docker-compose build && docker-compose up
  1. Ingesting SIS Courses into the Local DB
# Attach a shell to the web docker container.
docker exec -it <container_name> bash                       # also possible in vscode

# run cache course script
# make sure to run in the code/ directory NOT code/data
node data/cacheSISCoursesWithVersions.js

View the contents of your local database in MongoDBCompass using the URI mongodb://localhost:27017/debug. Don't see it? You may have to kill off existing processes at port 27017.

Testing

The ./tests/routes directory has test files for each of the API route files. Try running npm test!

About

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 20