This is the backend for uCredit, 4-year course planning, streamlined. Deployed on Render.
- Development deployment: https://ucredit-dev.onrender.com/
- Production deployment: https://ucredit-api.onrender.com/
Please allow a few seconds for the server to start up.
- API routes saved in ./routes
- Mongoose Schema saved in ./model
- Tests saved in ./tests
- Database connection made in ./data/db.js
Pre-requisites: npm, git, mongodb
- Clone this repository.
git clone https://github.com/uCredit-Dev/uCredit-API.git
- Install dependencies.
npm i
- Create .env file at the root. Copy paste .env for development! (Ask a dev for access)
touch .env
- Start server.
npm start
- Navigate to http://localhost:4567/
To run program from a fresh clone:
- Update .env file with the following:
DEBUG=True
SIS_API_KEY=YOUR_API_KEY
- Build docker:
docker-compose build && docker-compose up
- 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.
The ./tests/routes directory has test files for each of the API route files. Try running npm test
!