Skip to content
/ flask_api Public

Andela challenge 3 on creating an API using flask

Notifications You must be signed in to change notification settings

mwaz/flask_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coverage Status Build Status Codacy Badge

Yummy Recipes Application API

Challenge 3: A Flask API that enables one to create a recipe category, add, delete and update a category API also allows one to create recipes, update delete them using API endpoints

Find Heroku App here []

Requirements

  • python 3
  • Postgres Database Engine

Installation

1 Clone the Github Repositorty'

use ssh

$ git clone https://github.com/mwaz/flask_api.git

2 Install the Database Engine and Pip

$ sudo apt - get install python3-pip python3-dev libpq-dev

4 Create the PostgreSQL Database and User

   $ sudo - u postgres psql
   $ sudo - u postgres createuser postgres
   $ sudo - u postgres createdb flask_api

   postgres =  # GRANT ALL PRIVILEGES ON DATABASE flask_api TO postgres;

5 Create and run database migrations

$ python manage.py db init
$ python manage.py db migrate
$ python manage.py db upgrade

6 Set Up and activate a virtual environment

$ virtualenv venv
$ source venv/bin/activate

7 Install all application requirements using requirements.txt

  $ pip install -r requirements.txt

8 Run the Application

$ python run.py

Interact with the API: -), send http requests using Postman

Screenshot

image

User API Endpoints

URL Endpoint HTTP requests access status
/flask_api/v1/auth/register POST Register a new user public
/flask_api/v1/auth/login POST Login and retrieve token public

Categories API Endpoints

URL Endpoint HTTP requests access status
/flask_api/v1/categories/ POST Create a new recipe category private
/flask_api/v1/categories/ GET Retrieve all categories for user private
/flask_api/v1/categories/search/?q= & limit & page GET Retrieve all categories for a given search private
/flask_api/v1/categories/<category_id>/ GET Retrieve a category by ID private
/flask_api/v1/categories/<category_id>/ PUT Update a category private
/flask_api/v1/categories/<category_id>/ DELETE Delete a category private

Recipes API Endpoints

URL Endpoint HTTP requests access status
/flask_api/v1/categories/<category_id>/recipes/ GET Retrive recipes in a given category private
/flask_api/v1/categories/<category_id>/recipes/ POST Create recipes in a category private
/flask_api/v1/categories/<category_id>/recipes/search/?q=&limit&page GET Retrieve all recipes for a given search private
/flask_api/v1/categories/<category_id>/recipes/<recipe_id>/ DELETE Delete a recipe in a category private
/flask_api/v1/categories/<category_id>/recipes/<recipe_id>/ PUT update recipe details private

Run the APIs on postman to ensure they are fully functioning.

About

Andela challenge 3 on creating an API using flask

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published