This is an API for a Recipes service using Flask. Users can register an account and login to create, edit, view and delete recipe categories and recipes in those categories.
Sample documents is as bellow, A deatiled interactive documentation provided by swaggher is at your base URL locally it will be at;
http://127.0.0.0.1/5000/api
Note that your port number may differ
EndPoint | Functionality |
---|---|
POST /auth/login/ | Logs a user in |
POST /auth/register/ | Register a user |
DELETE /auth/logout/ | Logout a user |
POST /categories/ | Create a new category |
GET /categories/ | Get all categories |
GET /categories/<id>/ | Get a category by it's id |
PUT /categories/<id>/ | Update the category |
DELETE /categories/<id>/ | Delete the category |
POST /recipes | Create a recipe in the specified category |
GET /recipes/ | Get all recipes created by the logged in user |
GET /recipes/<id>/ | Get all recipes in the specified category id |
GET /recipes/<id>/ | Get a recipe in the specified category id |
PUT /recipes/<id>/ | Update the recipe in the specified category id |
[ DELETE /recipes//(#) | Delete the recipe in the specified category id |
To use the application, ensure that you have python 3.6+, clone the repository to your local machine. Open your git commandline and run
-
Clone the repository
git clone https://github.com/Thegaijin/recipeAPI.git
-
Enter the project directory
cd recipeAPI
-
Create a virtual environment
virtualenv venv
-
Activate the virtual environment
source venv/bin/activate
-
Then install all the required dependencies:
pip install -r requirements.txt
-
Install postgres if you don't already have it. Preferably Postgres 10.1.
-
Create the Databases
createdb api
createdb test_api
-
Run Migrations using these commands, in that order:
python manage.py db init python manage.py db migrate python manage.py db upgrade
-
To test the application, run the command :
python manage.py test
-
To start the server, run the command:
python manage.py runserver