mdelapenya / docker-captains-go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sample golang application with Testcontainers setup

This is a sample application implementing the TodoBackend functionality. It uses Testcontainers for setting up local environment for running the application.

Running

  1. Clone this repository or download and unzip it:
  2. git clone https://github.com/mdelapenya/docker-captains-go && cd docker-captains-go
  3. Run the application:
  4. go run -tags dev -v ./...
  5. Open the application in the browser: link
  6. Run docker ps to see the database container running.
  7. Check out dev_mode.go to see how Testcontainers is used to provide a development environment.

Optionally:

  1. Install Testcontainers Desktop (free)
  2. Configure Postgres service in the Testcontainers Desktop app
  3. Connect to the database from your IDE / database viewer using.
  4. Open terminal to the service (from the taskbar app menu):
  5. Run: psql -U postgres todos to connect to the database
  6. Execute: select * from todos; to see your data.

Requirements

  • Go 1.21
  • Docker environment

About

License:MIT License


Languages

Language:Go 51.7%Language:JavaScript 34.3%Language:HTML 9.0%Language:CSS 5.0%