kvb-api

command module
v0.0.0-...-ba3ee0b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2023 License: MIT Imports: 17 Imported by: 0

README

KVB API

Maintainability Test Coverage

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

Example

Request

GET http://localhost:8080/v1/departures/stations/bensberg

Response

{
  "departures": [
    {
      "line": "1",
      "destination": "Weiden West",
      "arrivalInMinutes": 17
    },
    {
      "line": "1",
      "destination": "Junkersdorf",
      "arrivalInMinutes": 44
    }
  ]
}

Build

The binary will be stored at dist/kvb-api

make build

Build Docker Image

The binary will be stored at dist/kvb-api

make build-docker

Usage

Without Tracing

Start the KVB API without tracing by running:

./dist/kvb-api

To run with Docker, adapt the docker-compose.yaml and run:

docker-compose up
With OpenTelemetry

Start the KVB API with OpenTelemetry tracing by running:

make run-with-tracing

To run with Docker, adapt the docker-compose.yaml and run:

docker-compose up

Make sure an OpenTelemetry collector is running on the provided URL.

Development

Hexagonal Architecture
  • 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

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL