From 889d6943589c93b661346a2e59de2d30e11879c1 Mon Sep 17 00:00:00 2001 From: Preston Doris Date: Tue, 30 Jan 2018 07:26:22 -0800 Subject: [PATCH] Add if statement to run server if __name__ == '__main__' statement was added to make this a working server once the students add the required code. --- .../Starter Code/endpoints2.py | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/Lesson_3/04_Responding to Different Types of Requests/Starter Code/endpoints2.py b/Lesson_3/04_Responding to Different Types of Requests/Starter Code/endpoints2.py index 378418f..cc6d586 100644 --- a/Lesson_3/04_Responding to Different Types of Requests/Starter Code/endpoints2.py +++ b/Lesson_3/04_Responding to Different Types of Requests/Starter Code/endpoints2.py @@ -7,38 +7,43 @@ def puppiesFunction(): if request.method == 'GET': #Call the method to Get all of the puppies - - + + elif request.method == 'POST': #Call the method to make a new puppy - - - -#Make another app.route() decorator here that takes in an integer id in the + + + +#Make another app.route() decorator here that takes in an integer id in the def puppiesFunctionId(id): if request.method == 'GET': #Call the method to get a specific puppy based on their id - + if request.method == 'PUT': #Call the method to update a puppy - + elif request.method == 'DELETE': #Call the method to remove a puppy - + def getAllPuppies(): return "Getting All the puppies!" - + def makeANewPuppy(): return "Creating A New Puppy!" def getPuppy(id): return "Getting Puppy with id %s" % id - + def updatePuppy(id): return "Updating a Puppy with id %s" % id def deletePuppy(id): return "Removing Puppy with id %s" % id + + +if __name__ == '__main__': + app.debug = True + app.run(host='0.0.0.0', port=5000)