yummyrecipes_api is a RESTFul web api that let's users create accounts, login and create, view, edit and delete categories and recipes.
see the API Documentation by following this url
The API demo is deployed on heroku at https://hadijahyummyrecipe-api.herokuapp.com/apidocs/#/
Python3
- A programming language that lets us work more quickly (The universe loves speed!).Flask
- A microframework for Python based on Werkzeug, Jinja 2 and good intentionsVirtualenv
- A tool to create isolated virtual environmentPostgreSQL
– Postgres database offers many advantages over others.Psycopg2
– A Python adapter for Postgres.Flask-SQLAlchemy
– A Flask extension that provides support for SQLAlchemy.Flask-Migrate
– Offers SQLAlchemy database migrations for Flask apps using Alembic.
First clone this repository
$ git clone @https://github.com/hadijahkyampeire/newyummy_api
$ cd Yummy-Recipe-RestAPI
Create virtual environment and install it
$ virtualenv --python=python3 venv
$ source /venv/bin/activate
Then install all the necessary dependencies by
pip install -r requirements.txt
You need to create a test database for tests to run postgres# CREATE DATABASE test_db At the terminal or console type
set APP_SETTINGS=development
set DATABASE_URL_DEV=postgresql://postgres:@localhost/flask_api
psql -U postgres
postgres# CREATE DATABASE yummy_api
At the terminal or console type
export APP_SETTINGS=development
export DATABASE_URL=postgresql://postgres:@localhost/flask_api
psql -U postgres
postgres# CREATE ROLE postgres
postgres# CREATE DATABASE flask_api
$ python manage.py db init
$ python manage.py db migrate
$ python manage.py db upgrade
At the terminal or console type
python run.py
To run tests run this command at the console/terminal
nosetests or
python manage.py test
To run tests with coverage run this command at the console/terminal
python manage.py test_cov or
nosetests -v --with-coverages
End points | Functionality | Access |
---|---|---|
/api/v1/auth/register | Post, create account | PUBLIC |
/api/v1/auth/login | post, login | PUBLIC |
/api/v1/auth/reset_password | post, logout | PUBLIC |
/api/v1/auth/logout | post, logout | PUBLIC |
/api/v1/categories/ | post, add category | PRIVATE |
/api/v1/categories/ | Get, retrieve all categories | PRIVATE |
/api/v1/categories/id | Get, retrieve one category | PRIVATE |
/api/v1/categories/id | Put, Edit a category | PRIVATE |
/api/v1/categories/id | Delete, Delete a category | PRIVATE |
/api/v1/categories/id/recipes | post, add a recipe to a category | PRIVATE |
/api/v1/categories/id/recipes | Get, retrieve all recipes in a given category | PRIVATE |
/api/v1/categories/id/recipes/id | Get, retrieve a recipe in a given category | PRIVATE |
/api/v1/categories/id/recipes/id | Put, Edit a recipe in a given category | PRIVATE |
/api/v1/categories/id/recipes/id | Delete, Delete a recipe in a given category | PRIVATE |
----------------- | ----------------------- | ------------------- |
Test your setup using a client app like postman