https://github.com/andriykalashnykov/flight-path
REST API server to determine the flight path of a person
https://github.com/andriykalashnykov/flight-path
echo echo-framework github-actions github-ci go golang newman postman postman-test rest rest-api restful-api swagger swagger-ui swaggo
Last synced: about 1 month ago
JSON representation
REST API server to determine the flight path of a person
- Host: GitHub
- URL: https://github.com/andriykalashnykov/flight-path
- Owner: AndriyKalashnykov
- License: mit
- Created: 2023-03-15T13:06:36.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-09-07T23:59:48.000Z (about 1 month ago)
- Last Synced: 2025-09-12T00:09:22.953Z (about 1 month ago)
- Topics: echo, echo-framework, github-actions, github-ci, go, golang, newman, postman, postman-test, rest, rest-api, restful-api, swagger, swagger-ui, swaggo
- Language: Go
- Homepage:
- Size: 358 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/AndriyKalashnykov/flight-path/actions/workflows/ci.yml)
[](https://hits.sh/github.com/AndriyKalashnykov/flight-path/)
[](https://opensource.org/licenses/MIT)
[](https://app.renovatebot.com/dashboard#github/AndriyKalashnykov/flight-path)
# REST API server to determine the flight path of a personStory: There are over 100,000 flights a day, with millions of people and cargo being transferred around the world.
With so many people and different carrier/agency groups, it can be hard to track where a person might be.
In order to determine the flight path of a person, we must sort through all of their flight records.Goal: To create a simple microservice API that can help us understand and track how a particular person's flight path
may be queried. The API should accept a request that includes a list of flights, which are defined by a source and
destination airport code. These flights may not be listed in order and will need to be sorted to find the total
flight paths starting and ending airports.### Requirements
- [gvm](https://github.com/moovweb/gvm) Go 1.24.0
```bash
gvm install go1.24.0 --prefer-binary --with-build-tools --with-protobuf
gvm use go1.24.0 --default
```
- [nmv](https://github.com/nvm-sh/nvm) Node 20.6.0
```bash
nvm install 20.6.0
nvm use 20.6.0
npm install yarn --global
npm install npm --global
npm install -g pnpm
pnpm add -g pnpm
```
- Newman (a CLI to run Postman/Newman collections)
```bash
npm install --location=global newman
```
- [GolangCI lint](https://golangci-lint.run/welcome/install/#local-installation)
```bash
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.59.1
```
## Help```text
Usage: make COMMAND
Commands :
help - List available tasks
deps - Download and install dependencies
api-docs - Build source code for swagger api reference
test - Run tests
build - Build REST API server's binary
run - Run REST API locally
release - Create and push a new tag
update - Update dependencies to latest versions
open-swagger - Open browser with Swagger docs pointing to localhost
test-case-one - Test case 1 [["SFO", "EWR"]]
test-case-two - Test case 2 [["ATL", "EWR"], ["SFO", "ATL"]]
test-case-three - Test case 3 [["IND", "EWR"], ["SFO", "ATL"], ["GSO", "IND"], ["ATL", "GSO"]]
e2e - Run Postman/Newman end-to-end tests
```## Start REST API server
```bash
make run
```## Run test cases
```bash
make test-case-one
make test-case-two
make test-case-three
```## SwaggerUI
Take a look at autogenerated REST API Documentation
[Swagger API documentation - http://localhost:8080/swagger/index.html](http://localhost:8080/swagger/index.html)

## API Endpoint documentation
[API Endpoint documentation](./docs/swagger.json)
```json
"/calculate": {
"post": {
"description": "get the flight path of a person.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"FlightCalculate"
],
"summary": "Determine the flight path of a person.",
"operationId": "flightCalculate-get",
"parameters": [
{
"description": "Flight segments",
"name": "flightSegments",
"in": "body",
"required": true,
"schema": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
}
```## GitHub CI
GitHub CI has following steps:
- Checkout
- Set up Node.js (needed to run Postman/Newman end-to-end tests)
- Install dependencies
- Install Newman
- Set up Go
- Test
- Build
- Run
- Wait for REST API
- Run Postman/Newman end-to-end tests## Postman/Newman end-to-end tests
Utilized Postman collection exported to [JSON file](./test/FlightPath.postman_collection.json)
and executes same use cases as Makefile targets `test-case-one` `test-case-two` `test-case-three`