This are the instructions I followed for creating the API. The API was made in a MacBook, so the commands for the terminal are different form Windows.
The API was made in Visual Studio Code, so you need to have it installed. VSCode was used for comfort, because of being more visual when having folders opened and making changes with them.
Create a folder where the API is going to be (in local). The folder can have any name, but is better not to have blank spaces.
Open the folder in VSCode, and then open the terminal also in VSCode for writing the following commands:
pip list
This shows all the libraries installed at that moment there. Search for flask and virtualenv. If they are not there or an update is needed you can write the following commands:
pip install flask
pip install virtualenv
For creating the environment, in the same terminal:
python -m virtualenv env
This will create a folder called env that is going to be the environment data.
In the same folder where env is, you need to create another folder called src where the code for the API is going to be. You can create it either by right click and create or in the terminal typing:
mkdir src
You have to create a .py file inside src folder. It can have any name, in this repository there is an example of an API code named dataTeamAPI.py made for practicing how to make an API and explained in the code how it works. Once the code is finished or if any trials are needed the API can be executed writing this command in the terminal (first save the file):
python src/dataTeamAPI.py
This will run the API locally. In the terminal you can see the endpoint URL, you can click on it and the requests will be made in a browser or you can copy and paste that URL for making requests from python or insomnia.
If you want to terminate the execution of the API you can click: control + C