/yummy-recipes-api

The innovative yummy recipes app is an application that allows users to create, save and share meeting the needs of keeping track of awesome food recipes

Primary LanguagePython

Coverage Status Build Status Maintainability

Yummy Recipes API

A RESTful API for yummy recipes

Project Dependencies

  1. Python 3.6.*
  2. Postgresql 9.6.*
  3. Flask 0.12.*

Project Hosted on Heroku

How to run flask application

  1. Create a folder on your computer Clone repository to your computer into created folder

    git clone https://github.com/code-sleuth/yummy-recipes-api.git
    
  2. Navigate into created folder

    cd yummy-recipes
    
  3. Create and activate virtual environment.

        $ virtualenv  venv
    
        $ source venv/bin/activate
    

    More on setting up Virtual environment: how to set up virtual environment

  4. Install the packages in requirements.txt

    pip install -r requirements.txt

  5. Set up postgresql database and copy connection string for example.

    DATABASE_URL='postgres://<db_user_name>:<password>@localhost/<database_name>'

    and

    DATABASE_URL='postgres://<db_user_name>:<password>@localhost/<test_database_name>'

    How to setup postgresql: how to setup postgresql mac

  6. To start the api, using terminal, run the following commands

    export FLASK_APP='main_app.py'

    export APP_SETTINGS='development'

    export SECRET='i wont tell if you dont'

    export DATABASE_URL='postgres://<db_user_name>:<password>@localhost/<database_name>'

    export TEST_DB_URL='postgres://<db_user_name>:<password>@localhost/<test_database_name>

    flask run

  7. Using postman, the url to run the api locally is http://127.0.0.1:5000/.

  8. On the web, visit the url https://yummy-recipes-api-pro.herokuapp.com/swagger_docs/

  9. Using postman with web url https://yummy-recipes-api-pro.herokuapp.com/

10.Sample: Use postman to navigate the endpoints in the api.

Endpoints Example

  • Register new user Web url:

    https://yummy-recipes-api-pro.herokuapp.com/auth/register
    

    Locally:

    http://127.0.0.1:5000/auth/register
    
    {
        "username": "username",
        "fullname": "Full Name",
        "password": "Pass"
    }
    
  • More on the end point is availabe online via the documentation

      https://yummy-recipes-api-pro.herokuapp.com/swagger_docs/
    
  • Author

    Ibrahim Mbaziira