Micro Services Classroom Series – 18/Nov/2021

Completing the RecipeList Resource Implementation

  • Lets implement the recipe list resource implementation
  • Refer Here for the implementation done
  • Defining the Recipe Resource to support the get an individual recipe and update an specific recipe. Refer Here for the Implementation of the changes.
  • Publishing and Unpublishing Recipes: For this lets create a Recipe Publish Resource. Refer Here for the changes done

Configuring End points

  • Endpoints:
HTTP Verb Description Class and Method URL
GET Get all Recipes RecipeListResource.get http://localhost:5000/recipes
POST Create a Recipe RecipeListResource.post http://localhost:5000/recipes
GET Gets a Recipe RecipeResource.get http://localhost:5000/recipes/1
PUT Updates a recipe RecipeResource.put http://localhost:5000/recipes/1
PUT Publish a Recipe RecipePublishResource.put http://localhost:5000/recipes/1/publish
DELETE Unpublishes a Recipe RecipePublishResource.delete http://localhost:5000/recipes/1/publish
  • Lets create our main application file app.py
  • To publish the Resource, Create an api object from Flask_Restful.API and then use the add_resource method
  • Lets see the Routes Configured Preview
  • Now lets create POSTMAN Collection. It has only one request
  • Refer Here for the complete code.
  • Exercise: Try to Test the rest of the code by creating postman requests.

Leave a Comment

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

About continuous learner

devops & cloud enthusiastic learner