This is a sample API created to test the process of developing and deploying APIs using golang and its tools. Created by Hector Menezes.
Use a db.env
to declare the database environment variables:
POSTGRES_USER=test
POSTGRES_PASSWORD=test
POSTGRES_DB=url-shortener
Use a api.env
to declare the API environment variables. The databse information should be equal to the previous environment file:
POSTGRES_USER=test
POSTGRES_PASSWORD=test
POSTGRES_DB=url-shortener
POSTGRES_PORT=5432
POSTGRES_HOST=db
SHORTENER_BASE_URL=hm
To run locally, you'll only need to run with:
docker-compose up
Once the API container is running, just execute
docker exec -it url-shortener-api go test ./...
The swagger will be available at http://host:port/swagger/index.html
.