Skip to content

lab-64/split-the-bill-server

Repository files navigation

Split The Bill - Server

Go Webserver Testing


Developer Get Started

1. Install Go

2. Clone the repository

3. Install Reflex package (needed for Hot Reload)

  • run go install github.com/cespare/reflex@latest

4. Install swag package (needed for fiber-swagger)

  • run go install github.com/swaggo/swag/cmd/swag@latest

Start Application

1. Set storage type in .env:

  • STORAGE_TYPE=ephemeral for Ephemeral
  • STORAGE_TYPE=postgres for Postgres

2a. Start the application (no docker, ephemeral only) with:

make watch

2b. (OR) Start the application (docker, ephemeral & postgres) with:

make start-db

3b. Add database seeding (docker has to run simultaneously in a different terminal):

make seed-db

4b. Stop the application with:

make stop-db

5b. Reset the database with:

make reset-db

Testing

make test-all

pgAdmin

1. Open http://localhost:5050

2. Click "Add New Server"

3. Set some "Name" in the "General" tab

4. Go to "Connection" tab and set:

  • Host name/address: split-the-bill-postgres-db
  • Password: postgres123

5. Check "Save password" and save the connection


Deyploment

TODO's before we deploy:

Change variables in .env:

DB_USER
DB_PASSWORD
PGADMIN_EMAIL
PGADMIN_PASSWORD

Remove development flags from docker-compose.yml:

PGADMIN_CONFIG_SERVER_MODE
PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED

URLs