Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

This is my captsone project for IBM.


# DevOps Capstone Template

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
Expand Down
16 changes: 14 additions & 2 deletions service/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
############################################################
# Health Endpoint
############################################################


@app.route("/health")
def health():
"""Health Status"""
Expand All @@ -22,6 +24,8 @@ def health():
######################################################################
# GET INDEX
######################################################################


@app.route("/")
def index():
"""Root URL response"""
Expand All @@ -38,6 +42,8 @@ def index():
######################################################################
# CREATE A NEW ACCOUNT
######################################################################


@app.route("/accounts", methods=["POST"])
def create_accounts():
"""
Expand All @@ -60,6 +66,8 @@ def create_accounts():
######################################################################
# LIST ALL ACCOUNTS
######################################################################


@app.route("/accounts", methods=["GET"])
def list_accounts():
"""
Expand All @@ -77,6 +85,8 @@ def list_accounts():
######################################################################
# READ AN ACCOUNT
######################################################################


@app.route("/accounts/<int:account_id>", methods=["GET"])
def get_accounts(account_id):
"""
Expand All @@ -93,7 +103,9 @@ def get_accounts(account_id):
######################################################################
# UPDATE AN EXISTING ACCOUNT
######################################################################
@app.route("/accounts/<int:account_id>", methods=["PUT"])


app.route("/accounts/<int:account_id>", methods=["PUT"])
def update_accounts(account_id):
"""
Update an Account
Expand All @@ -105,7 +117,6 @@ def update_accounts(account_id):
account = Account.find(account_id)
if not account:
abort(status.HTTP_404_NOT_FOUND, f"Account with id [{account_id}] could not be found")

account.deserialize(request.get_json())
account.update()

Expand All @@ -115,6 +126,7 @@ def update_accounts(account_id):
# DELETE AN ACCOUNT
######################################################################


@app.route("/accounts/<int:account_id>", methods=["DELETE"])
def delete_accounts(account_id):
"""
Expand Down
Loading