After cloning the repository in your desired location, please follow the following instructions to make sure you are able to run the project on your machine.
-
Open a terminal in the root of the project directory
Run the following commands on your terminal:
$ cd api && python -m venv venv
$ cd venv/Scripts && ./activate && cd ../../
$ pip install -r requirements.txt -
All the requirements for the API should now be installed.
To run the API on localhost, run the following commands in the project's root directory:
$ cd api/venv/Scripts && ./activate && cd ../../
$ cd src && python main.py
This should launch the uvicorn server on port 8000 (default). -
To test if it is running correctly, launch Postman.
Create a new HTTP request. Set the method toGETand the url to http://localhost:8000.
Go to the headers tab and add a new header with the namex-api-key, and the value as the value of thetestkey in theapi-keysobject inside theapi-config.jsonfile, present in the/apifolder of the project root directory.
Send the request. You should get the following response:
{"message": "hello world"}
Please note that any time you pull new changes from the repository,
please run the following commands in the project's root directory to update the requirements:
$ cd api/venv/Scripts && ./activate && cd ../../
$ pip install -r requirements.txt