2021-11-27 08:19:04 +00:00
# Score Tracker
2021-02-08 15:48:53 +00:00
2021-11-27 08:19:04 +00:00
Main repository: https://gitlab.sudoer.ch/sudoer777/score-tracker/
2021-02-08 15:48:53 +00:00
2021-11-27 08:19:04 +00:00
A web app designed to collect and display scores for sports
2021-02-08 15:48:53 +00:00
2021-11-27 08:19:04 +00:00
## Branches
2021-02-08 15:48:53 +00:00
2021-11-27 08:19:04 +00:00
- [main ](https://gitlab.sudoer.ch/sudoer777/score-tracker/-/tree/main ) - Stable, production-ready code
- [testing ](https://gitlab.sudoer.ch/sudoer777/score-tracker/-/tree/testing ) - Nearly complete code being tested
- [develop ](https://gitlab.sudoer.ch/sudoer777/score-tracker/-/tree/develop ) - Unstable code under development
2021-02-08 15:48:53 +00:00
2021-11-27 08:19:04 +00:00
## Installation
2021-02-08 15:48:53 +00:00
2022-03-10 01:08:05 +00:00
This repository can be cloned and then pushed to Heroku/Dokku/etc.
2021-02-08 15:48:53 +00:00
2021-11-27 08:19:04 +00:00
### Requirements
2021-02-08 15:48:53 +00:00
2022-03-10 01:08:05 +00:00
- PostgreSQL (with an empty database created and an account to access it)
2021-11-27 08:19:04 +00:00
### Environment Variables
- `NODE_ENV` - set to `production` , `testing` , or `development`
- `PGHOST` - set to your database URL
- `PGPORT` - set to the database port
- `PGDATABASE` - set to the name of your database (i.e. `scoretrackerdb` )
- `PGUSER` - set to the user for managing the database
- `PGPASSWORD` - set to the password for that user
2021-12-07 18:20:35 +00:00
- `PUBLIC_SUBMIT_PAGE` (default: `false` ) - set to `true` to allow score submissions without an account
2021-11-27 08:19:04 +00:00
## Code
This program uses Node.js/Express.js for the backend, PostgreSQL for the database (with node-postgres), and Passport.js for managing users and sessions.
2022-03-10 01:08:05 +00:00
To view the code, clone the repository and open it in VSCode/VSCodium.
2021-11-27 08:19:04 +00:00
### Structure
- `database` folder contains backend scripts for managing and storing data.
- `mail` folder (currenly unused) contains backend scripts for sending emails.
- `public` folder contains publically accessible scripts and stylesheets for frontend.
- `scripts` folder contains scripts used by specific webpages.
- `stylesheets` folder contains CSS for various webpages.
- `routes` folder contains various routes used by the program.
- `about.js` directs to the about page (`/about`).
- `auth.js` deals with logging in and out (`/auth/*`).
- `checkLoginStatus.js` contains functions for checking the login status of the current user.
- `data.js` sends various data to the client in JSON format (`/data/*`).
2022-03-10 01:08:05 +00:00
- `fetch.js` sends more specific data formatted for specific pages in JSON format (`/fetch/*`)
2021-11-27 08:19:04 +00:00
- `index.js` directs to the home page (`/`).
- `manage.js` contains various functions that allows the user to add and edit items through the web browser (`/manage/*`).
- `views` folder contains pug templates for each webpage, and a `layout` template for the base layout of each page.
- `.env.example` is a template for the environment variables in a development workspace. Rename to `.env` and change values as needed.