REST API server for SFU course outlines, sessions, and instructors
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Table of Contents
Unofficial API for accessing SFU course outlines, sections, and instructors robustly and used to power sfucourses.com. Data is pulled from SFU Course Outlines REST API. This API is not affiliated with Simon Fraser University.
- Golang
To get a local copy up and running follow these simple example steps.
- Golang v1.23.3
- REST API Server - api.sfucourses.com
- Golang Script to fetch outlines, sessions, and sync instructors
-
Clone the repo
git clone https://github.com/brianrahadi/sfucourses-api.git
-
Change git remote url to avoid accidental pushes to base project
git remote set-url origin brianrahadi/sfucourses-api git remote -v # confirm the changes
-
Run the project through air.toml or docker
air is good for development with it's real-time file update sync
air
Docker is good for its 1-to-1 behaviour with production. You can either use docker build and run or docker compose.
docker build -t sfu-courses-api .
# Create .env file
echo "UPDATE_PASSWORD=your-secure-password-here" > .env
# Run with .env file
docker run -p 8080:8080 --env-file .env sfu-courses-api
curl -X POST http://localhost:8080/update \
-H "Content-Type: text/plain" \
-d "your-secure-password-here"
# View running containers
docker ps
# View logs
docker logs <container_id>
# View logs live
docker logs -f <container_id>
# Stop container
docker stop <container_id>
# Remove container
docker rm <container_id>
The API will be available at http://localhost:8080
once the container is running.
See the open issues for a full list of proposed features (and known issues).
Very recommended! very appreciated!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
### UPDATE_PASSWORD
Required for the `/update` endpoint. Set this environment variable to secure manual data updates.
```bash
export UPDATE_PASSWORD="your-secure-password-here"
Usage:
curl -X POST http://localhost:8080/update \
-H "Content-Type: text/plain" \
-d "your-secure-password-here"
Security Note: Never commit the actual password to version control. Use environment variables or secrets management in production.
To set up the pre-commit hooks:
cp hooks/pre-commit .git/hooks/
chmod +x .git/hooks/pre-commit
This way:
- The hook templates are version controlled
- Each developer can set up their own hooks
- The actual
.git/hooks
directory remains local to each developer's machine
Distributed under the MIT License. See LICENSE.txt
for more information.
Brian Rahadi - brian.rahadi@gmail.com
Project Link: https://github.com/brianrahadi/sfucourses-api
- https://go.dev/doc/ - Golang Dev docs