kellyhodis
9/10/2019 - 12:53 AM

Task 4. Status of your API

""" Create app.py inside folder v1 """
  from models import storage
  from api.v1.views import app_views
  
  app = instance of Flask
  
  # register blueprint app_views to app
  
  @app.teardown_appcontext
  # declare a method here to call storage.close()
  
  if __name__ == "__main__":
    # run app
    # host = env variable HBNB_API_HOST or 0.0.0.0 as default
    # port = env variable HBNB_API_PORT or 5000 as default
    # threaded=True
  
""" Create __init__.py inside views folder in v1 """
from flask import Blueprint
from api.v1.views.index import * // ignore PEP8 complaint
app_views = instance of Blueprint // url prefix /api/v1
""" Create index.py inside views folder in v1 """
from api.v1.views import app_views

@app.route('/status')
# object = app_views
# returns JSON "status": "OK"