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.
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")
- pip install flask
- pip install pymongo
- pip install python-dotenv
- pip install pymongo[srv]
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>
- cd my-project/
- git init
- heroku git:remote -a adesso-recipe-flask
- git add .
- git commit -am "make it better"
- git push heroku master
heroku git:remote -a adesso-recipe-flask