Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.env
node_modules
node_modules
scripts/input/*
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM node:24-alpine
WORKDIR /app
RUN apk add --no-cache curl
COPY package.json package-lock.json ./
RUN npm ci --only=production
COPY . .
EXPOSE 3000
CMD [ "node", "src/server.js" ]
7 changes: 7 additions & 0 deletions Dockerfile.lambda
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM public.ecr.aws/lambda/nodejs:20
WORKDIR ${LAMBDA_TASK_ROOT}
RUN npm install -g npm@latest
COPY package.json package-lock.json ./
RUN npm ci --only=production
COPY src/ ./src/
CMD ["src/lambda.handler"]
1 change: 0 additions & 1 deletion Procfile

This file was deleted.

35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,34 @@
# VIA-API
# Introduction

This is the API provider for the [VIAplanner](https://github.com/VIAplanner/via-timetable) frontend. It handles database population and content serving to clients.

# Installation Using NPM

```sh
git clone https://github.com/VIAplanner/via-api
cd via-api
npm install
npm run dev
```

# Populating The Database Using NPM

1. Ensure that you have placed the following files (generated from the [scraper](https://github.com/Kelexer1/UofT-Scraper) ):
1. `courses.json` - Data for all offered courses in all currently offered sessions
2. `divisional.json` - Divisional data such as HTML legends, and enrolment indicator data
3. `reference.json` - Reference data such as more information on the currently offered sessions and their subsessions and all the divisions that are offering courses
4. `misc.json` - Other miscellaneous data

2. Run the following command to automatically clear the old database data and populate it with the new data
```sh
npm run populate
```

# .env Setup
**MONGODB_LOCAL_URI**

**MONGODB_URI**: A link to the mongodb database targeted for production, for example "mongodb://localhost:27017/via-api-dev"

**NODE_ENV**: Either 'development' or 'production', used to loosen/enforce CORs restrictions

**PORT**: The port that the backend should deploy on, defaulted to 3000 if not provided
Loading