Skip to content

A simple API to get manhattan distance between vectors.

License

Notifications You must be signed in to change notification settings

aymone/cartesian-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cartesian API

Go Report Card Maintainability Build Status

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

Running

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

Requirements

  • Go >= 1.12.x

  • Go mod

I hope you enjoy :D

About

A simple API to get manhattan distance between vectors.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published