THis is a django api to get the closest point from what you input
-
First install django and other setup requirements.
-
Then clone the application using
git clone [email protected]:Stephen-Kamau/ClosestPoint.git
-
AFter cloning,
cd ClosestPoint
and thenpython manage.py makemigrations
thenpython manage.py migrate
-
The above will run migratiosn.
-
YOu will then need to run it using
python manage.py runserver
as it will expose port 8000 by default and can be accessed via http methods. -
The app has a single endpoint whcih can either be post or get.
-
The endpoint is
api/v1/points
-
An example (Assuming you application is running on localhost).
-
You can use curl to do requests (Or any other client that you use..).
-
Make a post request with points such as
2,2;-1,30;0,2
- We do the following
curl -X POST -d "points=2,2;-1,30;0,2" http://localhost:8000/api/v1/points
- THe results will be
{"message": "Points and closest points saved successfully.", "inputs": "2,2;-1,30;0,2", "solution": "2,2;0,2"}
- We do the following
-
To get all points and their closest points that are saved, we do the following.
-