Go microservice with multi-arch support (amd64 & arm64)
109
This is a simple invoice microservice built in Go, using:
Environment variables required:
| Variable | Description |
|---|---|
NATS_URL. | NATS server URL (e.g. nats://localhost:4222) |
DATABASE_URL | PostgreSQL URL (e.g. postgresql://postgres:secret@localhost:5432/invoices) |
APP_ENV | Application environment: development or production (default is development) |
You can set them in your shell or via Docker -e flags.
Run the container:
docker run -d --name invoice-service --network host -e NATS_URL=nats://localhost:4222 -e DATABASE_URL="postgresql://postgres:secret@localhost:5432/invoices" -e APP_ENV=production invoice-ms
nats request invoice.create '{"amount": 199.99, "customer": "John Doe"}'
nats request invoice.get '{"id": "your-uuid-here"}'
nats request invoice.get_all ''
nats request invoice.update '{"id": "your-uuid-here", "amount": 299.99, "customer": "Jane Doe"}'
nats request invoice.delete '{"id": "your-uuid-here"}'
MIT License.
Content type
Image
Digest
sha256:a50e5f504โฆ
Size
7.9 MB
Last updated
over 1 year ago
docker pull carfdev/go-microservice