A simple API to get manhattan distance between 1xN vectors.
Sample:
GET "/api/points?x=1,y=1,distance=3"
Params:
"x": integer, required
"y": integer, required
"distance": integer, required
Return points ordered by increasing distance, limited by informed distance threshold:
[
{
"x": 2,
"y": -8
},
{
"x": 18,
"y": -3
},
]
Inside data dir exists a file called "points.json" that are used to calculate distances between informed coordinate
Important!
As we using go mod as dependency manager, maybe you will need to export GO111MODULE
env var before run this project.
Some people have dep
and mod
together, to avoiding conflicts with go dep
, just disable go mod
when you not using, this will prevent mod
to create files like go.mod
and go.sum
in your other projects with dep.
#on/off/auto
export GO111MODULE=auto
Inside root directory exists a Makefile
to better instrumentation of that available commands:
By default the app will run on localhost:8080, to change port:
export PORT=3000
Running the project
make run
Testing
make tests
Coverage
make coverage
Updating dependencies
make deps
-
Go >= 1.12.x
-
Go mod