|
1 | | -# Backend README |
| 1 | +# Special Standard Backend |
| 2 | + |
| 3 | +## Getting Started |
| 4 | + |
| 5 | +The backend is written in [Golang](https://go.dev/learn/) and handles code dependencies with Go modules managed within go.mod and go.sum. |
| 6 | +In order to run the backend, the most straightforward way is to navigate to backend/cmd and execute **go run main.go** or |
| 7 | +**go build -o main . && ./main**. |
| 8 | + |
| 9 | +Alternatively, we will use **Docker** to build and run isolated containers to ensure that environment dependencies and runtimes are consistent across our machines. |
| 10 | + |
| 11 | +### Steps to use Docker |
| 12 | + |
| 13 | +Install [Docker Desktop](https://docs.docker.com/get-started/get-docker/) (or just [Docker Engine](https://docs.docker.com/engine/install/)). |
| 14 | + |
| 15 | +In a terminal of your choice: |
| 16 | + |
| 17 | +```bash |
| 18 | +cd /specialstandard |
| 19 | +docker compose up --build --watch |
| 20 | +``` |
| 21 | + |
| 22 | +This will compose a cluster consisting of the backend and frontend containers. |
| 23 | +Docker Watch is utilized for hot/live reloading to make development easier. The Docker Engine |
| 24 | +watches for changes within the backend and frontend, syncs file changes from |
| 25 | +the host to the respective container, and then restarts the respective container. |
| 26 | + |
| 27 | +To end development, in the terminal press ctrl+c / cmd+c OR in another terminal execute: |
| 28 | + |
| 29 | +```bash |
| 30 | +docker compose down |
| 31 | +``` |
| 32 | + |
| 33 | +Open <http://localhost:8080/health> with your browser to see the result. Requests *should* be logged in your terminal. |
| 34 | + |
| 35 | +## Postman |
| 36 | + |
| 37 | +For further development and testing, install [Postman](https://www.postman.com/downloads/), which simplifies making network requests. |
| 38 | + |
| 39 | +## Learn More |
| 40 | + |
| 41 | +- [Go Modules](https://faun.pub/understanding-go-mod-and-go-sum-5fd7ec9bcc34) - article about go.mod and go.sum. |
| 42 | +- [Tour of Go](https://go.dev/tour/welcome/1) - guided tour of Golang. |
| 43 | +- [Go Video](https://youtu.be/8uiZC0l4Ajw?si=YJq6z9nqTN-B-c8c) - fantastic build up of data structures and syntax to write a complicated API. |
| 44 | +- [Fiber Framework](https://docs.gofiber.io/) - web framework, similar to Express, SpringBoot, Flask, FastAPI, etc. |
| 45 | +- [Docker Engine](https://docs.docker.com/engine/) - documentation for docker building and running docker containers. |
| 46 | +- [pgx](https://pkg.go.dev/github.com/jackc/pgx) - driver and toolkit for PostgreSQL which can be used to interact with Supabase. |
| 47 | +- [Supabase](https://supabase.com/docs) - database hosting service, with Auth service alongside. |
| 48 | + |
| 49 | +This tech stack is totally flexible--suggestions are welcome! |
0 commit comments