Rest API to get upcoming departures per KVB train station
Implemented in Go with hexagonal architecture and tracing via OpenTelemetry and Jaeger
KVB API provides one endpoint allowing you to get the upcoming departures for a provided station name
http://localhost:8080/v1/departures/stations/{station_name}
KVB API tries to find the best matching station name for your request, so it doesn't need to be the exact name
Request
GET http://localhost:8080/v1/departures/stations/bensberg
Response
{
"departures": [
{
"line": "1",
"destination": "Weiden West",
"arrivalInMinutes": 17
},
{
"line": "1",
"destination": "Junkersdorf",
"arrivalInMinutes": 44
}
]
}The binary will be stored at dist/kvb-api
make buildThe binary will be stored at dist/kvb-api
make build-dockerStart the KVB API without tracing by running:
./dist/kvb-apiTo run with Docker, adapt the docker-compose.yaml and run:
docker-compose upStart the KVB API with OpenTelemetry tracing by running:
make run-with-tracingTo run with Docker, adapt the docker-compose.yaml and run:
docker-compose upMake sure an OpenTelemetry collector is running on the provided URL.
- Adapters are stored in
adapters - Ports are stored in
ports - Business logic data structures are stored in
domains - Functions offered by the business logic are stored in
services