Skip to content

mustafa60x/d_python-recipeFlask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About App

I developed a backend service about adding recipes and listing.

The git repo is connected to Heroku and when the master branch is triggered, automatic deploy starts.

It uses mongodb on mongoatlas as a database service.

Methods

Heroku is free to use, so it may take up to 30 seconds to start.

base_url: https://adesso-recipe-flask.herokuapp.com/

LIST all recipes (GET): https://adesso-recipe-flask.herokuapp.com/recipes

GET a single recipe (GET): https://adesso-recipe-flask.herokuapp.com/recipes/:recipe_id

CREATE a new recipe (POST): https://adesso-recipe-flask.herokuapp.com/recipes

Example with Python requests library:

new_recipe = {
                "title": "Sigara Böreği",
                "steps": ["1 kilo yufka", "Yarım kilo lor", "Sıvı yağ", "Tuz", "Karabiber"]
            }

requests.post("https://adesso-recipe-flask.herokuapp.com/recipes", json = new_recipe)

UPDATE the recipe (PATCH): https://adesso-recipe-flask.herokuapp.com/recipes/:recipe_id

Example with Python requests library:

new_recipe_values = {
                "title": "Sigara Böreği",
                "steps": ["1 kilo yufka", "Yarım kilo lor", "Sıvı yağ", "Tuz", "Karabiber"]
            }

requests.patch("https://adesso-recipe-flask.herokuapp.com/recipes/<recipe_id>", json = new_recipe_values)

DELETE the recipe (DELETE): https://adesso-recipe-flask.herokuapp.com/recipes/:recipe_id

Example with Python requests library:


requests.delete("https://adesso-recipe-flask.herokuapp.com/recipes/:recipe_id")

Requirements

  • pip install flask
  • pip install pymongo
  • pip install python-dotenv
  • pip install pymongo[srv]

Add .env file

export FLASK_APP=app
export FLASK_ENV=development
export TEST=test
export IS_HEROKU=test

export DB_USERNAME=<mongoatlas-username>
export DB_PASSWORD=<mongoatlas-user-password>

Heroku - Create a new Git repository

  • cd my-project/
  • git init
  • heroku git:remote -a adesso-recipe-flask

Heroku - Deploy your application

  • git add .
  • git commit -am "make it better"
  • git push heroku master

Heroku - Existing Git repository

heroku git:remote -a adesso-recipe-flask

Heroku - Deployment

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published