Microservices Classroom Series – 17/Nov/2021

Implementing delete recipe

  • Lets try to implement the Delete recipe functionality.
  • Refer Here for the changes done to implement the DELETE verb and added tests in postman.
  • Refer Here for the corrected tests in postman


  • Refer Here for the official documentation.
  • Flask-RESTful is a Flask extension that allows us to quickly develop RESTFUL APIs.
  • In the previous example, we have used @app.route decorator, Compared to this Flask-RESTful allows us to maintain and structure the API Endpoints in a much better and easier
  • Lets try to Create our own Recipe-Sharing Platform "InstaCook"
  • Lets create a new project InstaCook
    • Using Pycharm Terminal Install python packages
    pip install flask-restful
    pip freeze > requirements.txt
    • Now create a Debugger configuration
  • First we will build all the basic CRUD functions of the recipes.
  • Create a Recipe Model:
    • Recipe may have several attributes, to save the every details of these attributes we will model the recipe using class. Lets try to describe attributes
      • name: The name of the recipe
      • description: The description of the recipe
      • num_of_serving: The number of servings
      • cook_time: This cooking time requred in seconds
      • directions: The directions
      • is_publish: The publish status of the recipe; the default value is false which means draft
    • Lets create a new python package models and in the models package add a recipe.py
    • Refer Here for the changes done
  • Resourceful Routing:
    • The main building blocks in Flask-RESTful are resources.
    • Resources are build of Flask’s pluggable view.
    • The concept of resourceful routing is that we want to structure all the client request around resources.
    • In our recipe-sharing platform, we are going to group the CRUD actions ona recipe under RecipeResource.
    • Lets Create a folder called resources and then create recipe.py under resources
    • Refer Here for the RecipeListResource Skeleton

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin