The Yummy-Recipes flask Api is a token based application that provides the user with the registration fields for the user. To access the resources of the application, the registered user must provide the actual details for the authentication. Once the user is authenticated, he/she gets the authority to manipulate the categories and the recipes in the application. Below are the steps and descriptions to make sure the application to make sure that the application is up and running.
- Register Users modules
- Login users modules
- User Create, View, Edit and Delete categories modules
- User Create, View, Edit and Delete recipes modules
- Python 3.6 and above
- Flask
- Postman
- Postgres database
Open the terminal and navigate to the desired project folder:
cd <your directory>
Using SSH method:
git clone git@github.com:kaguna/Flask-API.git
Using HTTPS method:
git clone https://github.com/kaguna/Flask-API.git
or download the repository from https://www.github.com/kaguna
and
transfer the folder to the working directory.
- Move to the working directory
cd <working directory>
- Install the virtual environment
pip install virtualenv
- Create the virtual environment
python3 -m venv <name of choice>
- Activate the virtual environment
source <name of choice>/bin/activate
- Install all the required packages
pip install flask
- Create the requirements containing packages file by
pip freeze > requirements.txt
- Deactivate the virtual environment to install packages
deactivave
- Install project requirements
pip install -r requirements.txt
-
Create a postgres database
-
Change the URL location of the database in the
instance/config.py
- Run the application
(<virtualenv>) ~$ <project directory> python run.py
- To run tests
(<virtualenv>) ~$ <project directory> pytest --cov=tests/
URL Endpoints | HTTP Requests | Description | Public Access |
---|---|---|---|
POST auth/register/ | POST | Create a new user | TRUE |
POST auth/login/ | POST | Generate token and grant access to the resources | TRUE |
POST auth/logout/ | POST | Logout use and revoke access | TRUE |
POST auth/reset-password/ | POST | Reset user's password | TRUE |
URL Endpoints | HTTP Requests | Description | Public Access |
---|---|---|---|
POST categories/ | POST | Create a new category | FALSE |
GET categories/ | GET | Retrieve specific user's paginated categories | FALSE |
GET category/<category_id> | GET | Retrieve specific user category | FALSE |
PUT category/<category_id> | PUT | Edit a category name | FALSE |
DELETE category/<category_id> | DELETE | Delete a category | FALSE |
URL Endpoints | HTTP Requests | Description | Public Access |
---|---|---|---|
POST category/<category_id>/recipes/ | POST | Create a new recipe | FALSE |
GET category/<category_id>/recipes/ | GET | Retrieve specific category's paginated recipes | FALSE |
GET category/<category_id>/recipe/<recipe_id> | GET | Retrieve specific category recipe | FALSE |
PUT category/<category_id>/recipe/<recipe_id> | PUT | Edit a recipe name | FALSE |
DELETE category/<category_id>/recipe/<recipe_id> | DELETE | Delete a recipe | FALSE |
Test the API online here. It uses swagger for documentation.