This is a code repository for a workout tracking API project built in the Complete Go course on Frontend Masters.
The API project is built from scratch. Before watching the course, you should install:
- Go (version 1.24.2 or higher)
- Postgres and any DB tool like psql or Sequel Ace to run SQL queries.
- Docker and Docker Compose
- In the [Postgres Database Container lesson][database], the Docker container exposes Postgres on the default port of
5432. If you already have Postgres or something else running on that port and you get a connection error, you can use an alternate port but updating thedocker-compose.ymlto be something like"5433:5432". - In the [SQL Migrations with Goose lesson][goose], if you get a "command not found" error when running
goose -version, it's because the$HOME/go/bindirectory is not added to yourPATH. You can fix this temporarily by runningexport PATH=$HOME/go/bin:$PATH, but this will not persist if you close your terminal. A permanent fix would require addingexport PATH=$HOME/go/bin:$PATHto your.zshrcor.bashrc.
After the workout_store_test.go migration is added, the test will fail due to a foreign key violation. This is becasue the tests create a workout without a user_id. Creating a test user for the tests will fix this issue. The main branch has the working tests. See this commit for the fix.