How marcelofabianov/gocambio works
Project type and purpose
• This is a Go-based client-server application (a lightweight microservice system) packaged with Docker Compose.
• The server exposes an HTTP endpoint that fetches USD→BRL quotes from an external API, persists them in SQLite, and returns the JSON.
• The client invokes that server endpoint, extracts the “bid” value, and writes it to a text file.
File structure
• Top level
• docker-compose.yml – orchestrates two services (server & client) and named volumes for persistence.
• go.mod / go.sum – Go module definitions.
• .dockerignore / .gitignore – ignore rules for Docker build and VCS.
• Directories
• server/
– server.go: HTTP API logic, external-API call, SQLite persistence.
– Dockerfile: builds the server container.
• client/
– client.go: HTTP client logic, file write.
– Dockerfile: builds the client container.
README for additional insights
• Timeouts managed via Go’s context:
• 200 ms for external API call
• 10 ms for DB write
• 300 ms total for client→server call
• Volumes:
• server_data (cotacoes.db)
• client_output (cotacao.txt)