This is a simple API for showing managers and their respective subordinates (people who report directly to them).
Before getting started, you will need to have Python 3.9+ installed. Once done follow the steps below:
- To get started, fork and clone this repository.
- Run
pipenv install
to install the project dependencies, andpipenv shell
to activate your virtual environment. - Set the environment variables as follows:
export FLASK_APP=server/app.py
export FLASK_RUN_PORT=8000
-
You will then nee to run the migrations. To do this, use
flask db upgrade head
. This will create the database and tables in the database. -
Now run the command flask run` to have the app run on port 8000.
These are the various endpoints available:
This is an endpoint for reading and creating new subordinates.
GET /subordinates
{
"name": string,
"manager_id": string
}
Status Code | Description |
---|---|
200 | Successful |
POST /subordinates
Parameter | Type | Description |
---|---|---|
name |
string |
Required. A subordinate's name |
manager_id |
integer |
Optional. The subordinate's manager |
{
"name": string,
"manager_id": integer,
}
Status Code | Description |
---|---|
201 | OK |
- Flask
Made with