Skip to content

Latest commit

 

History

History
54 lines (37 loc) · 1.44 KB

README.md

File metadata and controls

54 lines (37 loc) · 1.44 KB

kylin-api

This API is set up for use with Python >= 3.7 and Docker. You can set-up your local environment manually or compose up with docker to launch a containerised version of the API.

Running locally

To run the server, you'll need to install a few requirements. To do this, run:

pip install -r requirements/common.txt

This will install only the dependencies required to run the server. To boot up the server, you can run:

bash bin/run.sh

This will start a Gunicorn server that wraps the Flask app defined in api/app.py.

You should now be able to send:

curl localhost:8080/health

And receive the response OK and status code 200.

Running with docker

Unsurprisingly, you'll need Docker installed to run this project with Docker. To launch a containerised version of the API, run:

docker compose up -d

Your server will boot up in a detached state as indicated by -d, and should be accessible as before. When you are ready to bring down your server, run:

docker compose down

Testing the API

Testing the API is set up using pytest. To execute tests you can install the project's development dependencies with:

pip install -r requirements/develop.txt

Then from the root directory, run:

pytest

This runs tests/test_api.py which contains test functions.