Skip to content

frenchap/fibonacci-golang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fibonacci-golang

Run in windows:

Prep

  • Make sure docker desktop is installed and running
  • Stop any running postgres containers
  • If you have postgres installed locally and running, stop it in the services settings

Powershell Commands (using your user is fine; admin ok, but not required)

$env:FI_API_DB_USER = 'postgres'
$env:FI_API_DB_PASSWORD = '12345-luggage-combo'
$env:FI_API_DB_NAME = 'postgres'
$env:FI_API_DB_PORT = '5432'
$env:FI_API_UPPER_BOUND = '50000'
docker run --name postgres-db  -e POSTGRES_PASSWORD=12345-luggage-combo -e POSTGRES_DB=postgres -d -p 5432:5432 postgres
go run main.go

Run in linux

Prep

  • Make sure docker is installed and running (docker desktop if WSL2)
  • Stop any running postgres containers
  • If postgres is installed and running locally, stop the service

  • Note, the tests won't currently run in WSL2 linux environments

Shell commands

export FI_API_DB_USER="postgres"
export FI_API_DB_PASSWORD="12345-luggage-combo"
export FI_API_DB_NAME="postgres"
export FI_API_DB_PORT="5432"
export FI_API_UPPER_BOUND="50000"
docker run --name postgres-db  -e POSTGRES_PASSWORD=12345-luggage-combo -e POSTGRES_DB=postgres -d -p 5432:5432 postgres
go run main.go

Example commands in postman:

  • Gets number of ordinals below 40: GET http://localhost:8080/ordinals/40
  • Gets the 10th fibonacci number: GET http://localhost:8080/values/10
  • Clears the stored values: DELETE http://localhost:8080/values

Cleanup

Use docker ps to identify any created images, docker stop <id> to stop the container, and docker rm <id> to remove them

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages