unkinben d45111645c
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
Initial commit
- REST API for calculating age breakdowns (years, months, weeks, days, hours, minutes, seconds)
- Birthtime configured as Unix timestamps
- Sleeps until next birthday countdown
- Per-person lookup via GET /age/{name}
- Docker and Makefile build support
- Woodpecker CI pipelines
2026-06-27 23:59:00 +10:00
2026-06-27 23:59:00 +10:00
2026-06-27 23:59:00 +10:00
2026-06-27 23:59:00 +10:00
2026-06-27 23:59:00 +10:00
2026-06-27 23:59:00 +10:00
2026-06-27 23:59:00 +10:00
2026-06-27 23:59:00 +10:00
2026-06-27 23:59:00 +10:00
2026-06-27 23:59:00 +10:00

age-api

A simple REST API that calculates age breakdowns for configured people.

Endpoints

GET /age

Returns age breakdowns for all configured people.

GET /age/{name}

Returns the age breakdown for a single person by name (case-insensitive).

Response Format

{
  "name": "alice",
  "dob": "1990-05-15",
  "birthtime": 642988800,
  "age": {
    "years": 36,
    "months": 433,
    "weeks": 1889,
    "days": 13222,
    "hours": 317328,
    "minutes": 19039680,
    "seconds": 1142380800
  }
}

Configuration

People are defined in config.yaml with birthtime as a Unix timestamp:

people:
  - name: alice
    birthtime: 642729600
  - name: bob
    birthtime: 501465600

Environment Variables

Variable Default Description
CONFIG_PATH config.yaml Path to the configuration file
LISTEN_ADDR :8080 Address and port to listen on

Build

make build    # build binary to bin/age-api
make test     # run tests
make docker   # build docker image
S
Description
Simple API for showing a users age
Readme 34 KiB
Languages
Go 65.6%
Makefile 27%
Dockerfile 7.4%